forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGridEditor.cs
More file actions
44 lines (37 loc) · 1.43 KB
/
GridEditor.cs
File metadata and controls
44 lines (37 loc) · 1.43 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
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using UnityEngine;
namespace UnityEditor
{
[CustomEditor(typeof(Grid))]
[CanEditMultipleObjects]
internal class GridEditor : Editor
{
private SerializedProperty m_CellSize;
private SerializedProperty m_CellGap;
private SerializedProperty m_CellLayout;
private SerializedProperty m_CellSwizzle;
private void OnEnable()
{
m_CellSize = serializedObject.FindProperty("m_CellSize");
m_CellGap = serializedObject.FindProperty("m_CellGap");
m_CellLayout = serializedObject.FindProperty("m_CellLayout");
m_CellSwizzle = serializedObject.FindProperty("m_CellSwizzle");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(m_CellSize);
using (new EditorGUI.DisabledGroupScope(m_CellLayout.enumValueIndex == (int)Grid.CellLayout.Hexagon))
EditorGUILayout.PropertyField(m_CellGap);
EditorGUILayout.PropertyField(m_CellLayout);
EditorGUILayout.PropertyField(m_CellSwizzle);
serializedObject.ApplyModifiedProperties();
}
void OnSceneGUI()
{
// This enables a toggle in the Annotation Manager
}
}
}