-
Notifications
You must be signed in to change notification settings - Fork 1
/
Int3Drawer.cs
30 lines (25 loc) · 1.03 KB
/
Int3Drawer.cs
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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEditor;
using UnityEngine;
namespace HoloToolkit.Unity
{
/// <summary>
/// Property drawer for in-editor display/editing of Int3 data
/// </summary>
[CustomPropertyDrawer(typeof(Int3))]
public class Int3Drawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
label = EditorGUI.BeginProperty(position, label, property);
var contentPosition = EditorGUI.PrefixLabel(position, label);
var subLabels = new GUIContent[3];
subLabels[0] = new GUIContent("x");
subLabels[1] = new GUIContent("y");
subLabels[2] = new GUIContent("z");
EditorGUI.MultiPropertyField(contentPosition, subLabels, property.FindPropertyRelative("x"));
EditorGUI.EndProperty();
}
}
}