forked from TouchScript/TouchScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTouchDebuggerEditor.cs
More file actions
71 lines (60 loc) · 2.42 KB
/
TouchDebuggerEditor.cs
File metadata and controls
71 lines (60 loc) · 2.42 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using TouchScript.Debugging;
using UnityEditor;
using UnityEngine;
namespace TouchScript.Editor.Debugging
{
[CustomEditor(typeof(TouchDebugger))]
internal sealed class TouchDebuggerEditor : UnityEditor.Editor
{
private TouchDebugger instance;
private SerializedProperty texture, useDPI, touchSize, showTouchId, showTags;
private void OnEnable()
{
instance = target as TouchDebugger;
showTouchId = serializedObject.FindProperty("showTouchId");
showTags = serializedObject.FindProperty("showTags");
texture = serializedObject.FindProperty("texture");
useDPI = serializedObject.FindProperty("useDPI");
touchSize = serializedObject.FindProperty("touchSize");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(texture, new GUIContent("Touch Texture"));
if (EditorGUI.EndChangeCheck() && Application.isPlaying)
{
instance.TouchTexture = texture.objectReferenceValue as Texture2D;
}
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(useDPI, new GUIContent("Use DPI"));
if (EditorGUI.EndChangeCheck() && Application.isPlaying)
{
instance.UseDPI = useDPI.boolValue;
}
if (useDPI.boolValue)
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(touchSize, new GUIContent("Touch Size"));
if (EditorGUI.EndChangeCheck() && Application.isPlaying)
{
instance.TouchSize = touchSize.floatValue;
}
}
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(showTouchId, new GUIContent("Show Touch Id"));
if (EditorGUI.EndChangeCheck() && Application.isPlaying)
{
instance.ShowTouchId = showTouchId.boolValue;
}
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(showTags, new GUIContent("Show Tags"));
if (EditorGUI.EndChangeCheck() && Application.isPlaying)
{
instance.ShowTags = showTags.boolValue;
}
serializedObject.ApplyModifiedProperties();
}
}
}