protected override void AwakeOverride() { WindowType = RuntimeWindowType.Game; m_gameCameras = Editor.Object.Get(false).Select(obj => obj.GetComponent <GameViewCamera>()).Where(obj => obj != null && obj.IsAwaked).ToList(); if (m_gameCameras.Count > 0) { m_camera = m_gameCameras[0].Camera; } if (m_renderTextureOutput != null) { m_renderTextureCameras = new List <RenderTextureCamera>(); for (int i = 0; i < m_gameCameras.Count; ++i) { GameViewCamera gameViewCamera = m_gameCameras[i]; CreateRenderTextureCamera(gameViewCamera); } } UpdateVisualState(); GameViewCamera._Awaked += OnCameraAwaked; GameViewCamera._Destroyed += OnCameraDestroyed; GameViewCamera._Enabled += OnCameraEnabled; GameViewCamera._Disabled += OnCameraDisabled; GameViewCamera._CameraEnabled += OnCameraComponentEnabled; GameViewCamera._CameraDisabled += OnCameraComponentDisabled; m_gameView = this; base.AwakeOverride(); }
private void OnSceneSaved() { for (int i = 0; i < m_gameCameras.Count; ++i) { GameViewCamera gameCamera = m_gameCameras[i]; gameCamera.Camera.enabled = enabled; } }
private void OnBeforeSceneSave(UIControls.CancelArgs arg) { for (int i = 0; i < m_gameCameras.Count; ++i) { GameViewCamera gameCamera = m_gameCameras[i]; gameCamera.Camera.enabled = gameCamera.IsCameraEnabled; } }
public override void SetCameraDepth(int depth) { base.SetCameraDepth(depth); for (int i = 0; i < m_gameCameras.Count; ++i) { GameViewCamera gameCamera = m_gameCameras[i]; gameCamera.Camera.depth = depth + gameCamera.Depth; } }
protected virtual void OnEnable() { for (int i = 0; i < m_gameCameras.Count; ++i) { GameViewCamera gameCamera = m_gameCameras[i]; gameCamera.Camera.enabled = gameCamera.IsCameraEnabled; gameCamera.enabled = true; } }
protected override void OnEnable() { base.OnEnable(); for (int i = 0; i < m_gameCameras.Count; ++i) { GameViewCamera gameCamera = m_gameCameras[i]; gameCamera.Camera.enabled = gameCamera.IsCameraEnabled; gameCamera.enabled = true; } }
private void CreateRenderTextureCamera(GameViewCamera gameViewCamera) { GameObject gameViewCameraGo = gameViewCamera.gameObject; bool wasActive = gameViewCameraGo.activeSelf; gameViewCameraGo.SetActive(false); RenderTextureCamera renderTextureCamera = gameViewCameraGo.AddComponent <RenderTextureCamera>(); renderTextureCamera.OutputRoot = m_renderTextureOutput; m_renderTextureCameras.Add(renderTextureCamera); gameViewCameraGo.SetActive(wasActive); }
protected virtual void OnDisable() { if (m_gameView == this) { for (int i = 0; i < m_gameCameras.Count; ++i) { GameViewCamera gameCamera = m_gameCameras[i]; if (gameCamera.Camera != null) { if (Editor.IsOpened) { gameCamera.enabled = false; gameCamera.Camera.enabled = false; } } } } }