In this chapter, we learned how to create custom inspectors.
CustomEditor class is part of the
UnityEditor namespace and it's necessary to make a class a custom inspector. This class must inherit from the
Editor class and must be nested in an
Editor folder in order to work.
An inspector, such as a
MonoBehaviour class, has its own message method. These events are
OnDestroy. To make changes to the GUI, you must override the method
There are several classes to add the GUI in the inspector: the
EditorGUI classes are similar, with the only difference being that the first one auto adapts the GUI elements based in a layout, and the second one requires the specification of a rectangle to be used as a container of the element.
There is a class called
GUILayout, with generic GUI elements that can be used in a video game or editor context. The
Button method is part of this class.
It's important to review the API reference of these...