public 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); CarCameraCapturer cameraCapturer = go.GetComponent <CarCameraCapturer>(); if (cameraCapturer == null) { cameraCapturer = Undo.AddComponent <CarCameraCapturer>(go); } Undo.RecordObject(go, "Change camera capturer "); cameraCapturer.enabled = true; cameraCapturer.cranimation = crAnimation_; cameraCapturer.folder = folderPath; Undo.CollapseUndoOperations(Undo.GetCurrentGroup()); } } }
public void RemoveCameraRecorder() { Camera mainCamera = Camera.main; if (mainCamera != null) { GameObject go = mainCamera.gameObject; CarCameraCapturer cameraCapturer = go.GetComponent <CarCameraCapturer>(); if (cameraCapturer != null) { Undo.DestroyObjectImmediate(cameraCapturer); EditorGUIUtility.PingObject(go); } } }
void OnEnable() { capturer_ = (CarCameraCapturer)target; }