Tanoda
AnchorEditor.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 Leap.Unity;
10using System.Collections;
11using System.Collections.Generic;
12using UnityEditor;
13using UnityEngine;
14
15namespace Leap.Unity.Interaction {
16
17 [CanEditMultipleObjects]
18 [CustomEditor(typeof(Anchor))]
19 public class AnchorEditor : CustomEditorBase<Anchor> {
20
21 protected override void OnEnable() {
22 base.OnEnable();
23
24 deferProperty("_eventTable");
25 specifyCustomDrawer("_eventTable", drawEventTable);
26 }
27
28 private EnumEventTableEditor _tableEditor;
29 private void drawEventTable(SerializedProperty property) {
30 if (_tableEditor == null) {
31 _tableEditor = new EnumEventTableEditor(property, typeof(Anchor.EventType));
32 }
33
34 _tableEditor.DoGuiLayout();
35 }
36
37 }
38
39}
void deferProperty(string propertyName)
Defer rendering of a property until the end of the inspector. Deferred properties are drawn in the RE...
void specifyCustomDrawer(string propertyName, Action< SerializedProperty > propertyDrawer)
Specify a callback to be used to draw a specific named property. Should be called in OnEnable.