Mercurial > hg > Game > Games
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Orchestland/Assets/LeapMotion/Editor/LeapImageRetrieverEditor.cs Fri Jul 17 23:09:20 2015 +0900 @@ -0,0 +1,19 @@ +using UnityEngine; +using UnityEditor; +using System.Collections; + +[CustomEditor (typeof (LeapImageRetriever))] +public class LeapImageRetrieverEditor : Editor { + + public override void OnInspectorGUI() { + base.OnInspectorGUI(); + + SerializedProperty eyeProperty = serializedObject.FindProperty("eye"); + if (eyeProperty.enumValueIndex == -1) { + LeapImageRetriever retrieverScript = target as LeapImageRetriever; + bool containsLeft = retrieverScript.gameObject.name.ToLower().Contains("left"); + eyeProperty.enumValueIndex = containsLeft ? (int)LeapImageRetriever.EYE.LEFT : (int)LeapImageRetriever.EYE.RIGHT; + serializedObject.ApplyModifiedProperties(); + } + } +}