comparison Orchestland/Assets/LeapMotion/Editor/LeapImageRetrieverEditor.cs @ 1:f7675884f2a1

Add Orchestland project
author Daiki OYAKAWA <e135764@ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2015 23:09:20 +0900
parents
children
comparison
equal deleted inserted replaced
0:347d21cdfc22 1:f7675884f2a1
1 using UnityEngine;
2 using UnityEditor;
3 using System.Collections;
4
5 [CustomEditor (typeof (LeapImageRetriever))]
6 public class LeapImageRetrieverEditor : Editor {
7
8 public override void OnInspectorGUI() {
9 base.OnInspectorGUI();
10
11 SerializedProperty eyeProperty = serializedObject.FindProperty("eye");
12 if (eyeProperty.enumValueIndex == -1) {
13 LeapImageRetriever retrieverScript = target as LeapImageRetriever;
14 bool containsLeft = retrieverScript.gameObject.name.ToLower().Contains("left");
15 eyeProperty.enumValueIndex = containsLeft ? (int)LeapImageRetriever.EYE.LEFT : (int)LeapImageRetriever.EYE.RIGHT;
16 serializedObject.ApplyModifiedProperties();
17 }
18 }
19 }