forked from TouchScript/TouchScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputSourceEditor.cs
More file actions
44 lines (37 loc) · 1.25 KB
/
InputSourceEditor.cs
File metadata and controls
44 lines (37 loc) · 1.25 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using TouchScript.Editor.Utils;
using TouchScript.InputSources;
using UnityEditor;
using UnityEngine;
namespace TouchScript.Editor.InputSources
{
[CustomEditor(typeof(InputSource), true)]
public class InputSourceEditor : UnityEditor.Editor
{
private const string TEXT_ADVANCED_HEADER = "Advanced properties.";
private SerializedProperty advanced;
protected virtual void OnEnable()
{
advanced = serializedObject.FindProperty("advancedProps");
}
public override void OnInspectorGUI()
{
serializedObject.UpdateIfDirtyOrScript();
EditorGUI.BeginChangeCheck();
var expanded = GUIElements.BeginFoldout(advanced.isExpanded, new GUIContent("Advanced", TEXT_ADVANCED_HEADER));
if (EditorGUI.EndChangeCheck())
{
advanced.isExpanded = expanded;
}
if (expanded)
{
GUILayout.BeginVertical(GUIElements.FoldoutStyle);
drawAdvanced();
GUILayout.EndVertical();
}
GUIElements.EndFoldout();
serializedObject.ApplyModifiedProperties();
}
protected virtual void drawAdvanced()
{}
}
}