Example #1
0
        /// <summary>
        /// 全ヒエラルキーを非アクティブ化.
        /// </summary>
        private static void SuspendSceneInstance()
        {
            var rootObjects = UnityEditorUtility.FindRootObjectsInHierarchy(false);

            // SceneInitializerの初期化を待つ(Awake, Startを走らせない)為.
            // 一時的にHierarchy上のオブジェクトを非アクティブ化.
            foreach (var rootObject in rootObjects)
            {
                rootObject.SetActive(false);
            }

            Prefs.suspendObjectNames = rootObjects.Select(y => y.gameObject.name).ToArray();
        }
        /// <summary>
        /// 非アクティブ化したObjectを復帰.
        /// </summary>
        public static void ResumeSceneInstance()
        {
            var enableInstanceIds = Prefs.enableInstanceIds;

            var rootObjects = UnityEditorUtility.FindRootObjectsInHierarchy();

            rootObjects = rootObjects.Where(x => enableInstanceIds.Contains(x.gameObject.GetInstanceID())).ToArray();

            // 非アクティブ化したオブジェクトを復元.
            foreach (var rootObject in rootObjects)
            {
                rootObject.SetActive(true);
            }
        }
Example #3
0
        /// <summary>
        /// 非アクティブ化したObjectを復帰.
        /// </summary>
        private static void ResumeSceneInstance()
        {
            var rootObjects = UnityEditorUtility.FindRootObjectsInHierarchy();

            ResumeSuspendObject(rootObjects);
        }