コード例 #1
0
        static void HandleSelectionWhenSwithingToNewPrefabMode(GameObject prefabContentsRoot, UInt64 previousFileID)
        {
            GameObject newSelection = null;

            if (previousFileID != 0)
            {
                newSelection = FindFirstGameObjectThatMatchesFileID(prefabContentsRoot.transform, previousFileID, true);
            }

            if (newSelection == null)
            {
                newSelection = prefabContentsRoot;
            }

            Selection.activeGameObject = newSelection;

            // For Prefab Mode we restore the last expanded tree view state for the opened Prefab. For usability
            // if a child GameObject on the Prefab Instance is selected when entering the Prefab Asset Mode we select the corresponding
            // child GameObject in the Asset. Here we ensure that selction is revealed and framed in the Scene hierarchy.
            if (newSelection != prefabContentsRoot)
            {
                foreach (SceneHierarchyWindow shw in SceneHierarchyWindow.GetAllSceneHierarchyWindows())
                {
                    shw.FrameObject(newSelection.GetInstanceID(), false);
                }
            }
        }
コード例 #2
0
 public static void ReloadAllSceneHierarchies()
 {
     foreach (var window in SceneHierarchyWindow.GetAllSceneHierarchyWindows())
     {
         window.sceneHierarchy.ReloadData();
     }
 }