Exemple #1
0
        public override void ProcessAsset(SearchJob job)
        {
#if UNITY_2018_3_OR_NEWER
            PrefabStage stage = PrefabStageUtility.GetPrefabStage(sceneObjects[0]);
            if (stage != null)
            {
                isInPrefabStage = true;
            }
#endif

            roots = sceneObjects.ToArray();

            job.OnAssetSearchBegin();
            foreach (GameObject root in roots)
            {
                job.searchGameObject(root);
            }

#if UNITY_2018_3_OR_NEWER
            if (assetIsDirty && isInPrefabStage)
            {
                EditorSceneManager.MarkSceneDirty(stage.scene);
            }
#endif
        }
        public override void ProcessAsset(SearchJob job)
        {
#if UNITY_2018_3_OR_NEWER
            loadPrefab = job.scope.loadPrefab;
            // for the new prefab workflow we need to load the prefab into an
            // anonymous scene.

            if (roots == null)
            {
                if (loadPrefab)
                {
                    root = PrefabUtility.LoadPrefabContents(assetPath);
                }
                else
                {
                    root = (GameObject)AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityEngine.Object));
                }
                if (root == null)
                {
                    Debug.Log("Could not load " + assetPath + "!");
                    return;
                }
                shouldUnload = true;
                roots        = new UnityEngine.Object[] { root };
            }
            job.OnAssetSearchBegin();
            job.searchGameObject(root);
            job.OnAssetSearchEnd();

            if (assetIsDirty)
            {
                if (loadPrefab)
                {
                    // Known issue: when calling SaveAsPrefabAsset, unity will overwrite the name of the game object.
                    PrefabUtility.SaveAsPrefabAsset(root, assetPath);
                }
            }
#else
            root  = (GameObject)AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityEngine.Object));
            roots = new UnityEngine.Object[] { root };
            job.OnAssetSearchBegin();
            job.searchGameObject(root);
            job.OnAssetSearchEnd();
#endif
        }
        public override void ProcessAsset(SearchJob job)
        {
            ScriptableObject root = (ScriptableObject)AssetDatabase.LoadAssetAtPath(assetPath, typeof(ScriptableObject));

            if (root != null)
            {
                job.OnAssetSearchBegin();
                job.searchObject(root); // todo: cache for subjobs?
                job.OnAssetSearchEnd();
            }
        }
 public override void ProcessAsset(SearchJob job)
 {
     UnityEngine.Object root = (UnityEngine.Object)AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityEngine.Object));
     if (root != null)
     {
         roots = new Object[] { root };
         job.OnAssetSearchBegin();
         job.searchObject(root);
         job.OnAssetSearchEnd();
     }
 }
Exemple #5
0
        public override void ProcessAsset(SearchJob job)
        {
            AnimatorController root = (AnimatorController)AssetDatabase.LoadAssetAtPath(assetPath, typeof(AnimatorController));

            if (root != null)
            {
                roots = new Object[] { root };
                job.OnAssetSearchBegin();
                job.searchAnimatorController(root); // todo: cache for subjobs?
                job.OnAssetSearchEnd();
                // yield return job.searchDependencies(root);
            }
        }
 public override void ProcessAsset(SearchJob job)
 {
     UnityEngine.Object root = (UnityEngine.Object)AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityEngine.Object));
     if (root != null)
     {
         roots = new Object[] { root };
         job.OnAssetSearchBegin();
         job.searchObject(root); // todo: cache for subjobs?
         if (importer != null)
         {
             importer.SaveAndReimport();
         }
         job.OnAssetSearchEnd();
         // yield return job.searchDependencies(root);
     }
 }
        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);
            }
        }