Example #1
0
        private void MakeCameraScreenshots()
        {
            Camera mainCamera = Camera.main;

            if (mainCamera != null)
            {
                string folderPath = EditorUtility.SaveFolderPanel("CaronteFX - Select Folder", "", "");
                if (folderPath != string.Empty)
                {
                    EditorApplication.isPlaying = true;

                    GameObject go = mainCamera.gameObject;
                    EditorGUIUtility.PingObject(go);
                    ;
                    CRCameraCapturer cameraCapturer = go.GetComponent <CRCameraCapturer>();
                    if (cameraCapturer == null)
                    {
                        cameraCapturer = Undo.AddComponent <CRCameraCapturer>(go);
                    }

                    Undo.RecordObject(go, "Change camera capturer ");

                    cameraCapturer.enabled     = true;
                    cameraCapturer.cranimation = ac_;
                    cameraCapturer.folder      = folderPath;

                    Undo.CollapseUndoOperations(Undo.GetCurrentGroup());
                }
            }
        }
Example #2
0
        private void RemoveCameraRecorder()
        {
            Camera mainCamera = Camera.main;

            if (mainCamera != null)
            {
                GameObject       go             = mainCamera.gameObject;
                CRCameraCapturer cameraCapturer = go.GetComponent <CRCameraCapturer>();
                if (cameraCapturer != null)
                {
                    Undo.DestroyObjectImmediate(cameraCapturer);
                    EditorGUIUtility.PingObject(go);
                }
            }
        }