Conclusion
In this chapter, we introduced recipes demonstrating some Unity Editor extension scripts, illustrating how we can make things easier, less script based, and less prone to errors, by limiting and controlling the properties of objects and how they are selected or changed via the Inspector.
The concept of serialization was raised in the Editor extension recipes, whereby we need to remember that when we are editing item properties in the Inspector, each change needs to be saved to disk so that the updated property is correct when we next use or edit that item. This is achieved in the OnInspectorGUI()
method by first calling the serializedObject.Update()
method, and after all changes have been made in the Inspector, finally calling the serializedObject.ApplyModifiedProperties()
method. Some sources for more information and examples about custom Editor extensions include:
- For more about custom Unity Editors in Ryan Meier's blog, refer to http://www.ryan-meier.com/blog/?p=72
- For more...