public override void OnInspectorGUI() { serializedObject.Update(); SerializedProperty templateProp = serializedObject.FindProperty("template"); SerializedProperty recordingProp = templateProp.FindPropertyRelative("recording"); GUI.enabled = !(RecordingClipInspector.disableRecordingSwitch && Application.isPlaying); EditorGUILayout.PropertyField(recordingProp); GUI.enabled = true; RecordingBase recordingRef = recordingProp.objectReferenceValue as RecordingBase; if (recordingRef) { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("Recording Name", recordingRef.name); EditorGUILayout.LabelField("Type", recordingRef.GetType().Name); EditorGUILayout.LabelField("Duration", String.Format("{0:N2}", recordingRef.duration)); EditorGUILayout.LabelField("Count", recordingRef.Count().ToString()); EditorGUILayout.EndVertical(); } serializedObject.ApplyModifiedProperties(); }
private void RecordingGroup() { RecorderBase recorder = target as RecorderBase; RecordingBase recordingRef = recordingProp.objectReferenceValue as RecordingBase; string type = "-"; string duration = "-"; string recordCount = "0"; if (recordingRef) { type = recordingRef.GetType().Name; duration = String.Format("{0:N2}", recordingRef.duration); recordCount = recordingRef.Count().ToString(); } EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.PropertyField(recordingNameProp); EditorGUILayout.LabelField("Type", type); EditorGUILayout.LabelField("Duration", duration); EditorGUILayout.LabelField("Count", recordCount); EditorGUILayout.LabelField("Destination Folder", recorder.DestinationFolder); EditorGUILayout.EndVertical(); }
public override void OnInspectorGUI() { serializedObject.Update(); RecordingBase recording = target as RecordingBase; EditorGUILayout.BeginVertical(EditorStyles.helpBox); // recording details as labels EditorGUILayout.LabelField("Recording Name", recording.name); EditorGUILayout.LabelField("Type", recording.GetType().Name); EditorGUILayout.LabelField("Duration", String.Format("{0:N2}", recording.duration)); EditorGUILayout.LabelField("Count", recording.Count().ToString()); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); // button to log all data records if (GUILayout.Button("Log Recording", EditorStyles.miniButtonMid, GUILayout.Height(20))) { recording.Log(); } EditorGUILayout.Space(); // show data fields SerializedProperty field = serializedObject.GetIterator(); field.NextVisible(true); while (field.NextVisible(false)) { EditorGUILayout.PropertyField(field, true); } serializedObject.ApplyModifiedPropertiesWithoutUndo(); }