Unity's editor is powerful but limited, so sometimes you need to improve the editor to fit your own game. This is a tutorial on how to do that! In each tutorial you will make at least two scripts: a so-called Editor script which is similar to the regular C# scripts and that communicates with the C# script. The difference is that the Editor script has to be placed in a folder called Editor. You can have multiple Editor folders in different sub-folders to make it easier to organize your project.
The Editor scripts can be divided into two sections and you don't need both when making an Editor script. The first section is called OnInspectorGUI() and this is where you add code to add stuff like buttons to a script. These buttons can then be found in the Editor below the public variables that belongs to the script. The second section is called OnSceneGUI() and is similar to the Update() method but is updating the Editor so you don't have to click play for it to run.
This tutorial is divided into the following sections: