view 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 source

´╗┐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();
        }
    }
}