-
Notifications
You must be signed in to change notification settings - Fork 341
Expand file tree
/
Copy pathExample_70_ScrollViewWithOdinAttribute.cs
More file actions
67 lines (53 loc) · 1.71 KB
/
Example_70_ScrollViewWithOdinAttribute.cs
File metadata and controls
67 lines (53 loc) · 1.71 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
using Sirenix.OdinInspector;
using Sirenix.OdinInspector.Editor;
using UnityEditor;
using UnityEngine;
namespace ToolKits
{
public class Example_70_ScrollViewWithOdinAttribute : OdinEditorWindow
{
private static Example_70_ScrollViewWithOdinAttribute _window;
private Vector2 m_scrollPos;
[OnInspectorGUI("OnScrollBegin",false)]
[LabelWidth(100f)]
[TextArea]
public string a;
[LabelWidth(200f)]
[TextArea]
public string b;
[TextArea]
[LabelWidth(200f)]
public string c;
[LabelWidth(200f)]
[CustomValueDrawer("OnFloatDraw")]
public float d;
[OnInspectorGUI("OnScrollEnd")]
[TextArea]
[LabelWidth(200f)]
public string e;
private void OnScrollBegin()
{
m_scrollPos = EditorGUILayout.BeginScrollView(m_scrollPos, false,false, GUILayout.Height(100));
EditorGUILayout.BeginHorizontal();
}
private void OnScrollEnd()
{
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndScrollView();
}
private float OnFloatDraw(float value, GUIContent label)
{
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField(label);
value = EditorGUILayout.FloatField(value);
EditorGUILayout.EndVertical();
return value;
}
[MenuItem("Tools/Example_70_ScrollViewWithOdinAttribute", priority = 70)]
private static void Open()
{
_window = GetWindow<Example_70_ScrollViewWithOdinAttribute>();
_window.Show();
}
}
}