Skip to content

Inspector Utilities, More ScriptableObjects, and Property Drawers

Compare
Choose a tag to compare
@Nebby1999 Nebby1999 released this 30 Nov 16:22

0.2.1

Inspector Utilities

I've added a few protected methods that i've been using a lot with the new inspectors i've been writting lately. These protected methods act as shorthands and faster ways to write default methods found inside EditorGUILayout.

The utilities are the following:

DrawField(string propName) - Draws a property field by finding the property inside the SerializedObject that's being inspected
DrawField(SerializedProperty property, string propName) - Draws a property field by finding a child property of the given property.
Drawfield(SerializedProperty property) - Draws a property field
Header(string label) - Creates a LabelField that acts the same way as the [Header] attribute
Header(string label, string tooltip) - Creates a LabelField that acts the same way as a Header attribute, and contains a tooltip.

More ScriptableObjects

MynachMelyn, an user from the Risk of Rain 2 Modding discord told me the fact that a special skilldef called "SteppedSkillDef" couldn't be created in the Editor, this was due to the SteppedSkillDef not having the CreateAssetMenu attribute applied to it.

As a result, i dug deeper, and i found a total of 11 SkillDefs that didn't had the CreateAssetMenu, knowing this, i decided to revamp the "UnlockableDefCreator" into a "ScriptableCreator". which now contains methods for creating ScriptableObjects that are normally impossible to create due to lacking the CreateAssetMenu Attribute

PropertyDrawers

I've decided to add an EditorGUILayoutProperyDrawer class that extends from property drawer. it's main purpose is for the "Lazy" creation of extremely simple property drawers so that the end user doesnt have to deal with Rects and the complex system that GUILayout uses.

This EditorGUILayoutPropertyDrawer class is not going to replace the property drawer class used in the RoR2EditorKit property drawers, and its not meant to be an extension to the base class, unlike ExtendedInspector or ExtendedEditorWindow.