private void DrawState(EntityState state) { state.origin = EditorGUILayout.TextField("Origin", state.origin); state.startTime = DateTimeTk.DrawDateTime("Start Time", state.startTime); state.endTime = DateTimeTk.DrawDateTime("End Time", state.endTime); state.position = EditorGUILayout.Vector3Field(positionGUIContent, state.position); state.rotation.eulerAngles = EditorGUILayout.Vector3Field(rotationGUIContent, state.rotation.eulerAngles); }
public override void OnInspectorGUI() { // Update the serializedProperty - always do this in the beginning of OnInspectorGUI. serializedObject.Update(); DrawDefaultInspector(); GUILayout.Space(10); GUIStyle guiStyle = EditorStyles.foldout; FontStyle previousStyle = guiStyle.fontStyle; guiStyle.fontStyle = FontStyle.Bold; EntityHistory history = target as EntityHistory; GUI.enabled = false; DateTimeTk.DrawDateTime("Start Time", history.historyStartTime); DateTimeTk.DrawDateTime("End Time", history.historyEndTime); DateTimeTk.DrawTimeSpan("Offset", history.StartOffset); DateTimeTk.DrawTimeSpan("Duration", history.Duration); GUI.enabled = true; //foldOutStates = foldOutStates && history.entityStates.Length > 0; previousStyle = guiStyle.fontStyle; guiStyle.fontStyle = FontStyle.Bold; foldOutStates = EditorGUILayout.Foldout(foldOutStates, "States", guiStyle); guiStyle.fontStyle = previousStyle; GUILayout.Space(2); if (foldOutStates && history.entityStates != null) { EditorGUI.indentLevel++; for (int i = 0; i < history.entityStates.Length; i++) { EntityState state = history.entityStates[i]; EditorGUILayout.LabelField("State " + i + " " + state.state); EditorGUI.indentLevel++; DrawState(state); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } // Apply changes to the serializedProperty - always do this in the end of OnInspectorGUI. serializedObject.ApplyModifiedProperties(); }