public IEnumerator 優先順の設定が反映される()
        {
            BaseCamera.GetUniversalAdditionalCameraData().renderType     = CameraRenderType.Base;
            OverlayCamera1.GetUniversalAdditionalCameraData().renderType = CameraRenderType.Overlay;
            OverlayCamera2.GetUniversalAdditionalCameraData().renderType = CameraRenderType.Overlay;
            OverlayCamera3.GetUniversalAdditionalCameraData().renderType = CameraRenderType.Overlay;
            var component1 = OverlayCamera1.gameObject.AddComponent <AddOverlayCameraToCameraStack>();
            var component2 = OverlayCamera2.gameObject.AddComponent <AddOverlayCameraToCameraStack>();
            var component3 = OverlayCamera3.gameObject.AddComponent <AddOverlayCameraToCameraStack>();

            component1.GetType().GetField("priority", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(component1, 10.0f);
            component2.GetType().GetField("priority", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(component2, -10.0f);
            component3.GetType().GetField("priority", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(component3, 0.0f);
            yield return(null);

            var cameraStack = BaseCamera.GetUniversalAdditionalCameraData().cameraStack;

            Assert.That(cameraStack[0], Is.EqualTo(OverlayCamera2));
            Assert.That(cameraStack[1], Is.EqualTo(OverlayCamera3));
            Assert.That(cameraStack[2], Is.EqualTo(OverlayCamera1));
            yield return(SceneManager.UnloadSceneAsync(OverlayScene3));

            yield return(SceneManager.UnloadSceneAsync(OverlayScene2));

            yield return(SceneManager.UnloadSceneAsync(OverlayScene1));

            yield return(SceneManager.UnloadSceneAsync(BaseScene));
        }
Example #2
0
        public IEnumerator Overlay変換時にStackを引き継ぐ()
        {
            BaseCamera1.GetUniversalAdditionalCameraData().renderType    = CameraRenderType.Base;
            BaseCamera2.GetUniversalAdditionalCameraData().renderType    = CameraRenderType.Base;
            OverlayCamera1.GetUniversalAdditionalCameraData().renderType = CameraRenderType.Overlay;
            OverlayCamera2.GetUniversalAdditionalCameraData().renderType = CameraRenderType.Overlay;
            BaseCamera1.depth = 10.0f;
            BaseCamera2.depth = 20.0f;
            yield return(null);

            var componentForOverlayCamera1 = OverlayCamera1.gameObject.AddComponent <AddOverlayCameraToCameraStack>();

            componentForOverlayCamera1.GetType().GetField("priority", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(componentForOverlayCamera1, -10.0f);
            yield return(null);

            Assert.That(BaseCamera2.GetUniversalAdditionalCameraData().cameraStack[0], Is.EqualTo(OverlayCamera1));

            var componentForBaseCamera     = BaseCamera2.gameObject.AddComponent <AddOverlayCameraToCameraStack>();
            var componentForOverlayCamera2 = OverlayCamera2.gameObject.AddComponent <AddOverlayCameraToCameraStack>();

            componentForBaseCamera.GetType().GetField("priority", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(componentForBaseCamera, 10.0f);
            componentForOverlayCamera2.GetType().GetField("priority", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(componentForOverlayCamera2, 0.0f);
            yield return(null);

            var cameraStack = BaseCamera1.GetUniversalAdditionalCameraData().cameraStack;

            Assert.That(cameraStack[0], Is.EqualTo(OverlayCamera1));
            Assert.That(cameraStack[1], Is.EqualTo(OverlayCamera2));
            Assert.That(cameraStack[2], Is.EqualTo(BaseCamera2));
            yield return(SceneManager.UnloadSceneAsync(OverlayScene2));

            yield return(SceneManager.UnloadSceneAsync(OverlayScene1));

            yield return(SceneManager.UnloadSceneAsync(BaseScene2));

            yield return(SceneManager.UnloadSceneAsync(BaseScene1));
        }