public override void OnInspectorGUI() { VideoCaptureProCtrl videoCaptureCtrl = (VideoCaptureProCtrl)target; GUILayout.BeginVertical("box"); videoCaptureCtrl.debug = EditorGUILayout.Toggle("Debug Log", videoCaptureCtrl.debug); GUILayout.EndVertical(); GUILayout.BeginVertical("box"); GUILayout.Label("Capture Control"); videoCaptureCtrl.startOnAwake = EditorGUILayout.Toggle("Start On Awake", videoCaptureCtrl.startOnAwake); if (videoCaptureCtrl.startOnAwake) { videoCaptureCtrl.captureTime = EditorGUILayout.FloatField("Capture Duration (Sec)", videoCaptureCtrl.captureTime); } videoCaptureCtrl.quitAfterCapture = EditorGUILayout.Toggle("Quit After Capture", videoCaptureCtrl.quitAfterCapture); GUILayout.EndVertical(); GUILayout.BeginVertical("box"); GUILayout.Label("Capture Component"); SerializedObject serializedObject = new SerializedObject(target); serializedObject.Update(); EditorGUILayout.PropertyField(serializedObject.FindProperty("_videoCaptures"), true); serializedObject.ApplyModifiedProperties(); GUILayout.EndVertical(); if (GUI.changed) { EditorUtility.SetDirty(target); #if UNITY_5_4_OR_NEWER EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); #endif } }
private static void InitProCaptureProperty() { VideoCapturePro[] videoCaptures = FindObjectsOfType(typeof(VideoCapturePro)) as VideoCapturePro[]; VideoCaptureProCtrl videoCaptureCtrl = FindObjectOfType(typeof(VideoCaptureProCtrl)) as VideoCaptureProCtrl; if (videoCaptureCtrl == null || videoCaptures.Length <= 0) { return; } videoCaptureCtrl.videoCaptures = new VideoCapturePro[videoCaptures.Length]; for (int i = 0; i < videoCaptures.Length; i++) { videoCaptureCtrl.videoCaptures[i] = videoCaptures[i]; } }