Class BaseEditor<T>
A convenience base class for making inspector editors.
Inherited Members
Namespace: Cinemachine.Editor
Syntax
public class BaseEditor<T> : Editor, IPreviewable, IToolModeOwner where T : class
Type Parameters
Name | Description |
---|---|
T | The class we're editing |
Properties
Target
The target object, cast as the same class as the object being edited
Declaration
protected T Target { get; }
Property Value
Type | Description |
---|---|
T |
Methods
BeginInspector()
Clients should call this at the start of OnInspectorGUI.
Updates the serialized object and Sets up for excluded properties.
Declaration
protected virtual void BeginInspector()
DrawPropertyInInspector(SerializedProperty)
Draw a property in the inspector, if it is not excluded.
Property is marked as drawn, so will not be drawn again
by DrawRemainingPropertiesInInspector()
Declaration
protected virtual void DrawPropertyInInspector(SerializedProperty p)
Parameters
Type | Name | Description |
---|---|---|
SerializedProperty | p | The property to draw |
DrawRemainingPropertiesInInspector()
Draw all remaining unexcluded undrawn properties in the inspector.
Declaration
protected void DrawRemainingPropertiesInInspector()
ExcludeProperty(String)
Exclude a property from automatic inclusion in the inspector when DrawRemainingPropertiesInInspector() is called
Declaration
protected void ExcludeProperty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | The property to exclude |
FieldPath<TValue>(Expression<Func<T, TValue>>)
Magic code to get the string name of a field. Will not build if the field name changes.
Declaration
protected string FieldPath<TValue>(Expression<Func<T, TValue>> expr)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, TValue>> | expr | Call format is FieldPath(x => x.myField) |
Returns
Type | Description |
---|---|
String | The string name of the field |
Type Parameters
Name | Description |
---|---|
TValue | Magic experssion code |
FindAndExcludeProperty<TValue>(Expression<Func<T, TValue>>)
Return the Serialized property for a field, and exclude it from being automatically displayed in the inspector. Call this when you need to provide a custom UX for a field.
Declaration
protected SerializedProperty FindAndExcludeProperty<TValue>(Expression<Func<T, TValue>> expr)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, TValue>> | expr | Call format is FindAndExcludeProperty(x => x.myField) |
Returns
Type | Description |
---|---|
SerializedProperty | The serialized property for the field |
Type Parameters
Name | Description |
---|---|
TValue | Magic experssion code |
FindProperty<TValue>(Expression<Func<T, TValue>>)
Return the Serialized property for a field.
Declaration
protected SerializedProperty FindProperty<TValue>(Expression<Func<T, TValue>> expr)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, TValue>> | expr | Call format is FindProperty(x => x.myField) |
Returns
Type | Description |
---|---|
SerializedProperty | The serialized property for the field |
Type Parameters
Name | Description |
---|---|
TValue | Magic experssion code |
GetExcludedPropertiesInInspector()
Obsolete, do not use. Use the overload, which is more performant
Declaration
protected virtual List<string> GetExcludedPropertiesInInspector()
Returns
Type | Description |
---|---|
List<String> | List of property names to exclude |
GetExcludedPropertiesInInspector(List<String>)
Get the property names to exclude in the inspector.
Declaration
protected virtual void GetExcludedPropertiesInInspector(List<string> excluded)
Parameters
Type | Name | Description |
---|---|---|
List<String> | excluded | Add the names to this list |
IsPropertyExcluded(String)
Check whenther a property is in the excluded list
Declaration
protected bool IsPropertyExcluded(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | The property to check |
Returns
Type | Description |
---|---|
Boolean | True if property is excluded from automatic inclusion in the inspector when DrawRemainingPropertiesInInspector() is called |
OnInspectorGUI()
Draw the inspector
Declaration
public override void OnInspectorGUI()