Пример #1
0
        public UnityEngine.Object searchForObjectInScene()
        {
            Scene scene;

#if UNITY_2018_3_OR_NEWER
            if (SceneUtil.IsSceneStage())
            {
                scene = PrefabStageUtility.GetCurrentPrefabStage().scene;
                return(searchForObjectInScene(scene));
            }
#endif
            scene = EditorSceneManager.GetActiveScene();
            return(searchForObjectInScene(scene));
        }
Пример #2
0
        public override bool CanReplaceObject(UnityEngine.Object obj, out string reason)
        {
            reason = "";
            if (!(obj is GameObject))
            {
                reason = "Not a game object.";
                return(false);
            }

            GameObject go = (GameObject)obj;

            if (SceneUtil.IsSceneStage() && roots.Contains(go))
            {
                reason = "Cannot replace root of prefab.";
                return(false);
            }

            return(true);
        }
Пример #3
0
        public SceneViewSearchAssetData(string path) : base(path)
        {
            containsScripts = true;
#if UNITY_2018_3_OR_NEWER
            if (SceneUtil.IsSceneStage())
            {
                PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
                scene     = prefabStage.scene;
                assetPath = prefabStage.prefabAssetPath;
                roots     = new UnityEngine.Object[] { prefabStage.prefabContentsRoot };
            }
            else
            {
                addActiveScene();
            }
#else
            addActiveScene();
#endif
        }