Tanoda
Units.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9using UnityEngine;
10#if UNITY_EDITOR
11using UnityEditor;
12#endif
13
14namespace Leap.Unity.Attributes {
15
17 public readonly string unitsName;
18
19 public UnitsAttribute(string unitsName) {
20 this.unitsName = unitsName;
21 }
22
23#if UNITY_EDITOR
24 public float GetWidth() {
25 return EditorStyles.label.CalcSize(new GUIContent(unitsName)).x;
26 }
27
28 public void Draw(Rect rect, SerializedProperty property) {
29 GUI.Label(rect, unitsName);
30 }
31#endif
32 }
33}
UnitsAttribute(string unitsName)
Definition: Units.cs:19