UniqueDrawerKey

Gets a unique key for any given property within a drawer.

namespace Sirenix.OdinInspector.Editor
{
public struct UniqueDrawerKey : IEquatable<UniqueDrawerKey>
}

Requirements

Namespace: Sirenix.OdinInspector.Editor
Assembly: Sirenix.OdinInspector
Version: 1.0.6.1

Static Methods

Return Type Definition Description
UniqueDrawerKey Create(InspectorProperty, OdinDrawer) Gets a unique key for any given property within a drawer.
UniqueDrawerKey Create(IPropertyValueEntry, OdinDrawer) Gets a unique key for any given property within a drawer.

Methods

Return Type Definition Description
bool Equals(Object) Checks if two keys are identical.
bool Equals(UniqueDrawerKey) Checks if two keys are identical.
int GetHashCode() Returns a hash code for this instance.

Example

[OdinDrawer]
public class MyCustomTypeDrawer<T> : OdinValueDrawer<T> where T : MyCustomBaseType
{
    protected override void DrawPropertyLayout(IPropertyValueEntry<T> entry, GUIContent label)
    {
        var isToggled = entry.Context(this, "toggled", false);
        isToggled.Value = SirenixEditorGUI.Label(isToggled.Value, label);
        if (SirenixEditorGUI.BeginFadeGroup(UniqueDrawerKey.Create(entry, this), isToggled.Value))
        {
            EditorGUI.indentLevel++;
            this.CallNextDrawer(entry.Property, null);
            EditorGUI.indentLevel--;
        }
        SirenixEditorGUI.EndFadeGroup();
    }
}