Beispiel #1
0
        void AddToCurrentScene()
        {
            //シーンを開く
            string scenePath = GetSceneRelativePath();

            EditorApplication.OpenSceneAdditive(scenePath);

            //余分なオブジェクトを削除
            UtageUguiTitle title = UtageEditorToolKit.FindComponentAllInTheScene <UtageUguiTitle>();

            GameObject.DestroyImmediate(title.transform.root.gameObject);
            SystemUi systemUi = UtageEditorToolKit.FindComponentAllInTheScene <SystemUi>();

            GameObject.DestroyImmediate(systemUi.gameObject);

            //シーンのアセットを削除
            AssetDatabase.DeleteAsset(scenePath);

            //「宴」エンジンの初期化
            InitUtageEngine();

            //エンジン休止状態に
            AdvEngine engine = GameObject.FindObjectOfType <AdvEngine>();

            engine.gameObject.SetActive(false);

            Selection.activeObject = AssetDatabase.LoadAssetAtPath(scenePath, typeof(Object));
        }
        void AddToCurrentScene()
        {
            //すでにカメラがある場合は、宴関係のレイヤー設定を無効化する
            ChangeCameraMaskInScene();

            //すでにイベントシステムがある場合は、新しいほうを削除するために
            UnityEngine.EventSystems.EventSystem eventSystem = UtageEditorToolKit.FindComponentAllInTheScene <UnityEngine.EventSystems.EventSystem>();

            //シーンを開く
            string scenePath = GetSceneRelativePath();

            WrapperUnityVersion.OpenSceneAdditive(scenePath);


            //余分なオブジェクトを削除
            UtageUguiTitle title = UtageEditorToolKit.FindComponentAllInTheScene <UtageUguiTitle>();

            GameObject.DestroyImmediate(title.transform.root.gameObject);
            SystemUi systemUi = UtageEditorToolKit.FindComponentAllInTheScene <SystemUi>();

            GameObject.DestroyImmediate(systemUi.gameObject);

            //シーンのアセットを削除
            AssetDatabase.DeleteAsset(scenePath);

            //「宴」エンジンの初期化
            InitUtageEngine();

            //エンジン休止状態に
            AdvEngine engine = GameObject.FindObjectOfType <AdvEngine>();

            engine.gameObject.SetActive(false);

            ChangeLayerInCurrentScene();

            //すでにイベントシステムがある場合は、新しいほうを削除する
            if (eventSystem != null)
            {
                UnityEngine.EventSystems.EventSystem[] eventSystems = UtageEditorToolKit.FindComponentsAllInTheScene <UnityEngine.EventSystems.EventSystem>();
                foreach (var item in eventSystems)
                {
                    if (item != eventSystem)
                    {
                        GameObject.DestroyImmediate(item.gameObject);
                        break;
                    }
                }
            }
            Selection.activeObject = AssetDatabase.LoadAssetAtPath(scenePath, typeof(Object));
            FontChange(false);
        }