28 lines
833 B
C#
28 lines
833 B
C#
/*
|
|
* @author Valentin Simonov / http://va.lent.in/
|
|
*/
|
|
|
|
using TouchScript.Utils.Attributes;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace TouchScript.Editor.Utils.PropertyDrawers
|
|
{
|
|
[CustomPropertyDrawer(typeof(ToggleLeftAttribute))]
|
|
internal sealed class ToggleLeftDrawer : PropertyDrawer
|
|
{
|
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
|
{
|
|
label = EditorGUI.BeginProperty(position, label, property);
|
|
label.text = " " + label.text;
|
|
EditorGUI.BeginChangeCheck();
|
|
var boolValue = EditorGUI.ToggleLeft(position, label, property.boolValue);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
property.boolValue = boolValue;
|
|
}
|
|
EditorGUI.EndProperty();
|
|
}
|
|
}
|
|
}
|