Skip to content

Extending the Editor's Functionality with RoR2EditorKit's Systems

Nebby edited this page Mar 8, 2022 · 1 revision

Extending the Editor's Functionality with RoR2EditorKit's Systems.

RoR2EditorKit, much like Thunderkit, has a lot of systems that are extensible by definition. This guide provides small introductions to using the RoR2EditorKit systems to extend further the functionality of the UnityEditor.

Core aspects

Inspectors:

Most of unity's work is done via the Inspector, RoR2EditorKit has a special system of Inspectors that aid the user with small but useful functionality.

Since RoR2EK 2.0, The main system for inspectors have shifted from using EditorGUILayout & IMGUI, to using VisualElements & UIToolkit, while Inspectors with IMGUI code is still supported via IMGUIContainers, it is extremely recommended to look at VisualElements for familiarization. https://docs.unity3d.com/2020.1/Documentation/Manual/UIElements.html

RoR2EditorKit's main inspector is the ExtendedInspector, The ExtendedInspector allows you to create an inspector that can be either Toggled ON or OFF depending on the user's preferences. To create the Toggle, RoR2EditorKit has also the ComponentInspector and ScriptableObjectInspector, both inherit from ExtendedInspector, and are used for Components and ScriptableObjects respectively.

More information can be found on the ExtendedInspector page:

Material Inspectors:

RoR2EditorKit comes with systems to extend the MaterialEditor for use with a Specific shader, while not modifying any ShaderLab files themselves.

The system itself uses a combination of MaterialEditor methods and EditorGUILayout, since the MaterialEditor doesnt use VisualElements in any shape or form.

More information can be found on the ExtendedMaterialEditor page:

PropertyDrawers:

RoR2EditorKit comes with a myriad of different ways of creating PropertyDrawers, while in 2019.4 the property drawer system is still mainly IMGUI based, RoR2EditorKit has the VisualElementPropertyDrawer, which by itself can be used to create PropertyDrawers that uses UIToolkit.

Due to the nature of PropertyDrawers with VisualElements, it is required that the Inspector that's displaying the PropertyDrawer uses VisualElements, otherwise the IMGUI property drawer is used.

RoR2EditorKit also comes with IMGUIPropertyDrawer, which is an extension of the Regular PropetyDrawer for drawing with EditorGUI, and the EditorGUILayoutPropertyDrawer, the EditorGUILayoutPropertyDrawer is deprecated and not recommended to use.

More Information can be found on the PropertyDrawers page:

Windows:

RoR2EditorKit's old EditorWindow system using EditorGUILayout has also been replaced by the UIToolkit system.

Much like the ExtendedInspector, RoR2EditorKit also comes with the ExtendedEditorWindow, The Window system itself is extremely WIP and doesnt give as many utility features as the Old version, but it will be supported longterm.

More information can be found on the EditorWindows page: