blob: f4d25a86494c8d8785ccb9031a3e34dc63bffc38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
namespace AdvancedInspector
{
public class BooleanEditor : FieldEditor
{
public override Type[] EditedTypes
{
get { return new Type[] { typeof(bool) }; }
}
public override void Draw(InspectorField field, GUIStyle style)
{
object value = GetValue(field);
EditorGUI.BeginChangeCheck();
bool result;
if (style != null)
result = EditorGUILayout.Toggle((bool)value, style);
else
result = EditorGUILayout.Toggle((bool)value);
if (EditorGUI.EndChangeCheck())
field.SetValue(result);
}
}
}
|