コード例 #1
0
ファイル: HB.cs プロジェクト: calebaden/abomination
        private void DestroyHBCameras()
        {
#if UNITY_EDITOR
            Camera[] sceneViewCameras = UnityEditor.SceneView.GetAllSceneCameras();
            foreach (Camera camera in sceneViewCameras)
            {
                HBCamera hbCamera = camera.GetComponent <HBCamera>();
                if (hbCamera != null)
                {
                    DestroyImmediate(hbCamera);
                }
            }
#endif
            Camera[] cameras = GameObject.FindObjectsOfType <Camera>();
            foreach (Camera camera in cameras)
            {
                HBCamera hbCamera = camera.GetComponent <HBCamera>();
                if (hbCamera != null)
                {
#if UNITY_EDITOR
                    DestroyImmediate(hbCamera);
#else
                    Destroy(hbCamera);
#endif
                }
            }
        }
コード例 #2
0
ファイル: HB.cs プロジェクト: calebaden/abomination
        private void CreateHBCameras()
        {
#if UNITY_EDITOR
            Camera[] sceneViewCameras = UnityEditor.SceneView.GetAllSceneCameras();
            foreach (Camera camera in sceneViewCameras)
            {
                HBCamera hbCamera = camera.GetComponent <HBCamera>();
                if (hbCamera == null)
                {
                    hbCamera = camera.gameObject.AddComponent <HBCamera>();
                }
                hbCamera.SceneViewCamera = true;
            }
#endif
            Camera[] cameras = GameObject.FindObjectsOfType <Camera>();
            foreach (Camera camera in cameras)
            {
                HBCamera hbCamera = camera.GetComponent <HBCamera>();
                if (hbCamera == null)
                {
                    camera.gameObject.AddComponent <HBCamera>();
                }
            }
        }