Beispiel #1
0
        private void OnDestroy()
        {
            Debug.Log("OnDestroy");

            MonitorKeyGen.ReleaseKey(key);
            key = -1;
            if (_MonitorRoot != null)
            {
                GameObject.Destroy(_MonitorRoot);
            }

            // 明示的に破棄
            if (this.renderTexture)
            {
                RenderTexture.ReleaseTemporary(this.renderTexture);
            }
        }
Beispiel #2
0
        private void CreateMonitorObject()
        {
            if (key >= 0)
            {
                return;             // 初期化完了の場合、弾く!!
            }
            key          = MonitorKeyGen.GenKey();
            _MonitorRoot = new GameObject(string.Format("Monitor:{0}", key));
            MonitorRoot.transform.position = MonitorKeyGen.PositionFromKey(key);

            Camera                 = new GameObject("Camera").AddComponent <Camera>();
            Camera.clearFlags      = cameraSetting.clearFlags;
            Camera.backgroundColor = cameraSetting.backgroundColor;

            Camera.transform.SetParent(MonitorRoot.transform, false);
            Camera.transform.localPosition = cameraSetting.position;
            Camera.transform.rotation      = Quaternion.Euler(cameraSetting.rotation);
            Camera.fieldOfView             = cameraSetting.fieldOfView;
            Camera.orthographicSize        = cameraSetting.orthographicSize;
            Camera.orthographic            = cameraSetting.orthographic;
        }