The technical solutions explained are probably not the only way to go, but they are the one used making Radiant Blade.This tutorial will be split into several parts, as there are lots of subjects to be discussed. Player.cs is a simple MonoBehaviour script with the following members:and it will expose its members in the inspector by default:We have to make a custom inspector by overriding the default inspector of Player script. Since we are refreshing the palette on focus, it may not seem useful, but it’s a good habit to serialize the variables in an editor window.To display the prefabs, we need something intuitive to use.We could have a list of string containing the prefab names. 0x00007FF7F35E3AA5 (Unity) ActiveEditorTracker::ForceReloadInspector 0x00007FF7F2D37FF6 (Unity) SceneTracker::ForceReloadInspector 0x00007FF7F3A07DD6 (Unity) RefreshInternalV2 0x00007FF7F3A0A753 (Unity) StopAssetImportingV2 0x00007FF7F393F7CD (Unity) AssetDatabase::StopAssetImporting 0x00007FF7F3E67540 (Unity) … Editor extension for selecting all textures with the same packing tag by Phuoc Nguyen. The Editor Windows is provided by Unity to allow us to create our own tool inside the editor. Unity is the ultimate game development platform. Unity is the ultimate game development platform. It won’t be shipped with the actual game, but it’s executed inside the Unity editor.For it to work, you need to put the script in a folder named “Editor”, else Unity won’t consider it.As you may expect, we’ll use the method “OnGUI” to add the UI of our map editor, and the “OnSceneGUI” one to display helpers in the scene view.Notice that OnSceneGUI must be called via a delegate. For now, we will focus on the adding part.We can either use a custom GUI allowing us to declare assets via drag&drop, or via an “Add” button. It can be done in several other ways, but I mostly care about transparency so the user doesn’t need to be aware of this routine when adding new prefabs in the asset folder. Here is our custom inspector looking in the editor:We can also draw the default inspector whenever we needed using DrawDefaultInspector() method:In our next post, we will introduce to you Editor Windows and how they can extend the capability of Unity editor.Here are some cool and useful editor tools people have created for their ease:Copyright © 2020 Informa PLC To use the CustomEditor attribute, you must place your script inside an Editor folder, or in a folder nested inside an Editor folder.Let's take an example of the Player Class. You want to save your time by overriding a tedious and repetitive task because as the project size increases in terms of complexity, certain tasks are getting a reasonable amount of effort and getting prone to errors and crashes. If we don’t do that, the value will be lost when entering playmode. Copyright Synnaxium 2018 Dream-Theme — truly Fortunately, we can use “Editor Default Resources” instead.Here is the code to gather the prefabs, simple and easy:I modified the “OnFocus” method to include a refresh of the palette. By using Gamasutra, you accept Here's the code of basic override of default inspector of the Player script:We define the type of CustomEditor as Player and override the default inspector by overriding the OnInspectorGUI callback.Just like MonoBehaviour callbacks, there are callbacks for Editor class too. I found by mistake and I truly enjoyed – it’s quite hard to find such good articles about Unity.Awesome explanation, I was not undestanding why Editor Window doesn’t have OnSceneGui method like in Editor (for custom inspectors), but now I see that you need these delegates. You can undo a mistake by using ctrl+Z and the maps will be kept up-to-date even if you modify the prefabs afterward.Through this article, we have laid the fundamentals to have a working map editor, but it is in no way near a production-ready state.Great article! Ready?As a little extra, I’m using Unity’s Undo system and I am not breaking the prefab link. I’m going to take some time to share with you my knowledge about how to make a custom map editor in Unity. Much, much more straightforward.About the technicalities, the Editor code cannot access the Resources folder to load the prefabs, the folder is meant to contain the resources at runtime.

Unfortunately, Unity has very limited documentation on editor scripting, therefore, I decided to write a kick-starter post on editor scripting. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. I was developing an editor utility to automate my repetitive tasks and try not to invent wheel again and again. whose registered office is 5 Howick Place, London, SW1P 1WG. We could also have a list of toggles. To decipher this problem, Unity allows us to create custom inspectors for our scripts, so we can define how our exposed variables and their properties should look in the Inspector window.Every time you attach a MonoBehaviour script to a game object, all the public variables in that script are automatically exposed in the inspector. Part 1 was really great. Required fields are marked Game dev studio, working on Radiant Blade : with light comes darkness, an action rpg The solution is simple: we will provide a toggle so the user can express his intent.Now that this is out of our way, we can start working on something more tricky: actually displaying visual elements in the scene view.In this example, we are going to display a clamped green square to help visualize a virtual grid, as if we were making a classic tile-based game. It seems simple at first, but it’s actually a mess, as it depends of the cursor type, of whether you are clicking on an object or not and of whether you are interested by the click or by the fact that the button is pressed down.The API offered by Unity for this is way more complex that “Input”, and some key features are missing.