Namespace: | Sirenix.OdinInspector.Editor |
Assembly: | Sirenix.OdinInspector.Editor |
public sealed class PropertyState
This is a class for creating, getting and modifying a property's various states. An instance of this class always comes attached to an InspectorProperty.
See Odin's tutorials for more information about usage of the state system.
public PropertyState(InspectorProperty property, int index)
InspectorProperty | property | |
System.Int32 | index |
public bool LogChanges
public bool Enabled { get; set; }
public bool EnabledLastLayout { get; }
public bool Expanded { get; set; }
public bool ExpandedLastLayout { get; }
public bool Visible { get; set; }
public bool VisibleLastLayout { get; }
public void CleanForCachedReuse()
public void Create<T>(string key, bool persistent, T defaultValue)
System.String | key | |
System.Boolean | persistent | |
T | defaultValue |
T |
public bool Exists(string key)
System.String | key | The key to check. |
System.Boolean | True if the state exists, otherwise, false. |
public bool Exists(string key, out bool isPersistent)
System.String | key | The key to check. |
System.Boolean | isPersistent | If the state exists, this out parameter will be true if the state is persistent. |
System.Boolean | True if the state exists, otherwise, false. |
public bool Exists(string key, out bool isPersistent, out Type valueType)
System.String | key | The key to check. |
System.Boolean | isPersistent | If the state exists, this out parameter will be true if the state is persistent. |
System.Type | valueType | If the state exists, this out parameter will contain the type of value that the state contains. |
System.Boolean | True if the state exists, otherwise, false. |
public bool Exists(string key, out Type valueType)
System.String | key | The key to check. |
System.Type | valueType | If the state exists, this out parameter will contain the type of value that the state contains. |
System.Boolean | True if the state exists, otherwise, false. |
public T Get<T>(string key)
System.String | key | The key of the state to get. An System.InvalidOperationException will be thrown if a state with the given key does not exist. |
T | The value of the state. |
T | The type to get the state value as. An System.InvalidOperationException will be thrown if the state's value type cannot be assigned to T. |
public T GetLastLayout<T>(string key)
System.String | key | The key of the state to get. An System.InvalidOperationException will be thrown if a state with the given key does not exist. |
T | The value of the state during the last layout event. |
T | The type to get the state value as. An System.InvalidOperationException will be thrown if the state's value type cannot be assigned to T. |
public void Reset()
public void Set<T>(string key, T value)
System.String | key | The key of the state to set the value of. An System.InvalidOperationException will be thrown if a state with the given key does not exist. |
T | value | The value to set. |
T | The type to set the state value as. An System.InvalidOperationException will be thrown if T cannot be assigned to the state's value type. |