public override void OnInspectorGUI() { serializedObject.Update(); DRUtility.Label("Present"); CreateForm(); serializedObject.ApplyModifiedProperties(); }
private void CreateForm() { using (new EditorGUILayout.VerticalScope("Box")) { DRUtility.LabeledPropertyField("Name: ", propName); DRUtility.LabeledPropertyField("No. ", propIndex); GUILayout.Label("Description:"); propDescription.stringValue = EditorGUILayout.TextArea(propDescription.stringValue, GUILayout.Height(75), GUILayout.Width(Screen.width - 310)); DRUtility.LabeledPropertyFieldGenericBG <Sprite>("Image: ", propImage); for (int i = 0; i < pres.CharacterReactions.Count; i++) { var reaction = pres.CharacterReactions[i]; using (new EditorGUILayout.HorizontalScope("Box")) { using (new EditorGUILayout.VerticalScope()) { GUIStyle expr = new GUIStyle(); expr.normal.background = reaction.character.DefaultSprite; EditorGUILayout.LabelField(GUIContent.none, expr, GUILayout.Width(100), GUILayout.Height(100)); reaction.character = DRUtility.UnityField(reaction.character, 120, 20); } // Select Reaction using (new EditorGUILayout.VerticalScope()) { GUILayout.FlexibleSpace(); reaction.reactionLevel = (PresentReactionLevel)EditorGUILayout.EnumPopup(reaction.reactionLevel); GUILayout.FlexibleSpace(); } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); } } } if (GUILayout.Button("Add New Character Reaction", GUILayout.Width(200))) { pres.CharacterReactions.Add(new StudentReactions()); } }