Esempio n. 1
0
 static void DoSelectionInspector()
 {
     TryCreateInspectedEditor();
     if (selectedObjectEditor != null)
     {
         if (CutsceneUtility.selectedObject != null && !CutsceneUtility.selectedObject.Equals(null))
         {
             EditorTools.BoldSeparator();
             GUILayout.Space(4);
             ShowPreliminaryInspector();
             selectedObjectEditor.OnInspectorGUI();
         }
     }
 }
Esempio n. 2
0
        //Show selection inspector
        static void DoSelectionInspector()
        {
            var selection = CutsceneUtility.selectedObject as Object; //cast object

            if (currentDirectableEditor != null && (currentDirectableEditor.target != selection || selection == null))
            {
                var disableMethod = currentDirectableEditor.GetType().GetMethod("OnDisable", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
                if (disableMethod != null)
                {
                    disableMethod.Invoke(currentDirectableEditor, null);
                }
            }

            if (selection == null)
            {
                currentDirectableEditor = null;
                return;
            }

            Editor newEditor = null;

            if (!directableEditors.TryGetValue(selection, out newEditor))
            {
                directableEditors[selection] = newEditor = Editor.CreateEditor(selection);
            }

            if (currentDirectableEditor != newEditor)
            {
                var enableMethod = newEditor.GetType().GetMethod("OnEnable", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
                if (enableMethod != null)
                {
                    enableMethod.Invoke(newEditor, null);
                }
                currentDirectableEditor = newEditor;
            }

            EditorTools.BoldSeparator();
            GUILayout.Space(4);
            ShowPreliminaryInspector();
            currentDirectableEditor.OnInspectorGUI();
        }