Tanoda
OnUnityCallbackEditor.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 UnityEditor;
10
11namespace Leap.Unity.Recording {
12
13 [CustomEditor(typeof(OnUnityCallback))]
14 public class OnUnityCallbackEditor : CustomEditorBase<OnUnityCallback> {
15
16 private SerializedProperty _tableProp;
17 private EnumEventTableEditor _tableEditor;
18
19 protected override void OnEnable() {
20 base.OnEnable();
21
22 _tableProp = serializedObject.FindProperty("_table");
23 _tableEditor = new EnumEventTableEditor(_tableProp, typeof(OnUnityCallback.CallbackType));
24
25 specifyCustomDrawer("_table", drawTable);
26 }
27
28 private void drawTable(SerializedProperty p) {
29 _tableEditor.DoGuiLayout();
30 }
31 }
32}
void specifyCustomDrawer(string propertyName, Action< SerializedProperty > propertyDrawer)
Specify a callback to be used to draw a specific named property. Should be called in OnEnable.