Пример #1
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();

            Utility_Tracker tracker = (Utility_Tracker)target;

            for (int i = 0; i < children.Length; ++i)
            {
                GUIStyle currentStyle = EditorStyles.miniButtonMid;
                if (i == 0)
                {
                    currentStyle = EditorStyles.miniButtonLeft;
                }
                if (i == children.Length - 1)
                {
                    currentStyle = EditorStyles.miniButtonRight;
                }
                if (!children[i].gameObject.activeSelf)
                {
                    GUI.backgroundColor = disabledColor;
                    GUI.color           = disabledColor;
                }
                if (GUILayout.Button(children[i].gameObject.name, currentStyle))
                {
                    tracker.SetActive(i);
                }
                GUI.backgroundColor = Color.white;
                GUI.color           = Color.white;
            }

            GUILayout.EndHorizontal();
            GUILayout.Space(10);
        }
Пример #2
0
        protected void OnSceneGUI()
        {
            Event   e       = Event.current;
            KeyCode keyCode = e.keyCode;

            if (e.type != EventType.KeyDown)
            {
                return;
            }

            Utility_Tracker tracker   = (Utility_Tracker)target;
            Transform       transform = tracker.transform;

            for (int i = 0; i < transform.childCount; ++i)
            {
                if (transform.IsActiveTransform() && (keyCode == Utility.ALPHA_KEY_CODES[i]))
                {
                    tracker.SetActive(i);
                }
            }
        }