public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            LeftToggleAttribute attribute = (LeftToggleAttribute)base.attribute;

            if (property.propertyType == SerializedPropertyType.Boolean)
            {
                property.boolValue = EditorGUI.ToggleLeft(position, label, property.boolValue);
                return;
            }
            EditorGUI.LabelField(position, label.text, "Use LeftToggle with bool.");
        }
Esempio n. 2
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        position.height = 16;
        if (property.propertyType == SerializedPropertyType.Boolean)
        {
            LeftToggleAttribute leftToggle = attribute as LeftToggleAttribute;

            if (leftToggle.labelOverride == string.Empty)
            {
                property.boolValue = EditorGUI.ToggleLeft(position, label, property.boolValue);
            }
            else
            {
                property.boolValue = EditorGUI.ToggleLeft(position, leftToggle.labelOverride, property.boolValue);
            }
        }
        else
        {
            EditorGUI.LabelField(position, label.text, "Use LeftToggle with bool");
        }
    }