Infohazard.Core 1.4.1
Infohazard Core Utility Library
Loading...
Searching...
No Matches
Infohazard.Core.Editor.CoreDrawers Class Reference

Contains extensions to EditorGUI for drawing custom properties. More...

Static Public Member Functions

static void ValidatedObjectField (Rect position, SerializedProperty property, Type objType, GUIContent label, GUIStyle style, IObjectReferenceFieldAssignmentValidator validator)
 Draw an object field with a custom validator applied. More...
 
static void ObjectFieldWithInterfaces (Rect position, SerializedProperty property, Type objType, GUIContent label, GUIStyle style, IReadOnlyList< Type > interfaces)
 Draw an object field, ensuring that any assigned value implements a list of interfaces. More...
 
static void CreateNewInstanceDropDown (Type requiredType, Rect buttonRect, IReadOnlyList< Type > interfaces, Action< Type > createAction)
 Draw a button which, when pressed, will show a dropdown of all types that can be assigned to the given property. When the user clicks one of the options, their supplied callback will be triggered. More...
 
static void AssetDropdown (SerializedProperty property, Type type, Rect buttonRect, GUIContent content, IReadOnlyList< Type > interfaces=null)
 Draw a dropdown for selecting an asset to assign to a property. More...
 

Detailed Description

Contains extensions to EditorGUI for drawing custom properties.

Member Function Documentation

◆ AssetDropdown()

static void Infohazard.Core.Editor.CoreDrawers.AssetDropdown ( SerializedProperty  property,
Type  type,
Rect  buttonRect,
GUIContent  content,
IReadOnlyList< Type >  interfaces = null 
)
static

Draw a dropdown for selecting an asset to assign to a property.

Parameters
propertyThe property that will be assigned.
typeType of required object.
buttonRectRect in which to show the button.
contentContent to show in the button.
interfacesInterfaces that the object must implement.

◆ CreateNewInstanceDropDown()

static void Infohazard.Core.Editor.CoreDrawers.CreateNewInstanceDropDown ( Type  requiredType,
Rect  buttonRect,
IReadOnlyList< Type >  interfaces,
Action< Type >  createAction 
)
static

Draw a button which, when pressed, will show a dropdown of all types that can be assigned to the given property. When the user clicks one of the options, their supplied callback will be triggered.

Parameters
requiredTypeType of required object.
buttonRectRect in which to show the button.
interfacesInterfaces that the object must implement.
createActionAction to invoke when the user chooses a type.

◆ ObjectFieldWithInterfaces()

static void Infohazard.Core.Editor.CoreDrawers.ObjectFieldWithInterfaces ( Rect  position,
SerializedProperty  property,
Type  objType,
GUIContent  label,
GUIStyle  style,
IReadOnlyList< Type >  interfaces 
)
static

Draw an object field, ensuring that any assigned value implements a list of interfaces.

Parameters
positionPosition and size of the field.
propertyProperty being edited.
objTypeType of the field.
labelLabel to display.
styleStyle to use.
interfacesInterfaces that must be implemented.

◆ ValidatedObjectField()

static void Infohazard.Core.Editor.CoreDrawers.ValidatedObjectField ( Rect  position,
SerializedProperty  property,
Type  objType,
GUIContent  label,
GUIStyle  style,
IObjectReferenceFieldAssignmentValidator  validator 
)
static

Draw an object field with a custom validator applied.

Parameters
positionPosition and size of the field.
propertyProperty being edited.
objTypeType of the field.
labelLabel to display.
styleStyle to use.
validatorValidator to apply.

The documentation for this class was generated from the following file: