Ejemplo n.º 1
0
        protected override void OnStartTransitionOut()
        {
            if (material == null)
            {
                return;
            }

            _oldSceneTexture = new RenderTexture(Screen.width, Screen.height, 24);

            //make a copy of allCameras, since we'll be modifying it during iteraion
            IList <Camera> allCameras = Camera.allCameras.ToList();

            _clonedCameras = allCameras.Select(c => CameraUtils.CloneCamera(c).DontDestroyOnLoad()).ToList();

            foreach (Camera camera in _clonedCameras)
            {
                camera.targetTexture = _oldSceneTexture;
                camera.Render();
            }

            //we now have the old scene cached in _oldScene
        }