Пример #1
0
        protected override void processAsset(string assetPath)
        {
            Scene?currentScene = null;

            if (job.scope.projectScope == ProjectScope.CurrentScene)
            {
                currentScene = EditorSceneManager.GetActiveScene();
            }
            else
            {
                currentScene = SceneUtil.LoadScene(assetPath, OpenSceneMode.Single);
            }

            // Debug.Log("[SearchJob] scene:"+currentScene.path+" loaded.");
            GameObject[] rootObjects = currentScene.Value.GetRootGameObjects();

            foreach (GameObject go in rootObjects)
            {
                // Debug.Log("[SearchJob] root:"+go);
                job.searchGameObject(go);
            }
            if (job.assetData.assetIsDirty)
            {
                EditorSceneManager.SaveScene(currentScene.Value);
            }

            job.searchDependencies(rootObjects.ToArray());
        }
Пример #2
0
        public static void OpenObjectInScene(PathInfo pathInfo)
        {
            // Debug.Log("[SceneUtil] Opening object:" + pathInfo.FullPath());
            Scene?scene = SceneUtil.LoadScene(pathInfo.assetPath, OpenSceneMode.Single);

            if (scene.HasValue)
            {
                UnityEngine.Object obj = pathInfo.objID.searchForObjectInScene(scene.Value);
                Selection.activeObject = obj;
            }
        }
        public override void ProcessAsset(SearchJob job)
        {
            scene = SceneUtil.LoadScene(assetPath, OpenSceneMode.Single).Value;
            if (roots == null)
            {
                roots        = scene.GetRootGameObjects();
                shouldUnload = true;
            }

            job.OnAssetSearchBegin();
            foreach (GameObject root in roots)
            {
                job.searchGameObject(root);
            }
            job.OnAssetSearchEnd();
            //  yield return job.searchDependencies(roots.ToArray());

            if (assetIsDirty)
            {
                EditorSceneManager.SaveScene(scene);
            }
        }