public override void OnInspectorGUI() { CustomUtilities.DrawScriptableObjectField <CharacterActionsAsset>((CharacterActionsAsset)target); serializedObject.Update(); EditorGUILayout.PropertyField(boolActions, true); EditorGUILayout.PropertyField(floatActions, true); EditorGUILayout.PropertyField(vector2Actions, true); CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray); EditorGUILayout.HelpBox( "Click the button to replace the original \"CharacterActions.cs\" file. This can be useful if you need to create custom actions, without modifing the code. ", MessageType.Info ); if (GUILayout.Button("Create actions")) { bool result = EditorUtility.DisplayDialog( "Create actions", "Warning: This will replace the original \"CharacterActions\" file. Are you sure you want to continue?", "Yes", "No"); if (result) { CreateCSharpClass(); } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); CustomUtilities.DrawMonoBehaviourField <CharacterBody>((CharacterBody)target); if (monoBehaviour.transform.localScale != Vector3.one) { GUI.color = Color.red; GUILayout.BeginVertical("Box"); } CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray); DrawSize(); CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray); EditorGUILayout.PropertyField(mass); GUILayout.Space(10f); if (monoBehaviour.transform.localScale != Vector3.one) { EditorGUILayout.HelpBox("Transform local scale is not <1,1,1>!", MessageType.Warning); } if (monoBehaviour.transform.localScale != Vector3.one) { GUILayout.EndVertical(); } GUI.color = Color.white; serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); CustomUtilities.DrawMonoBehaviourField <CharacterBrain>((CharacterBrain)target); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUI.color = isAI.boolValue ? Color.white : Color.green; if (GUILayout.Button("Human", EditorStyles.miniButton)) { isAI.boolValue = false; } GUI.color = !isAI.boolValue ? Color.white : Color.green; if (GUILayout.Button("AI", EditorStyles.miniButton)) { isAI.boolValue = true; } GUI.color = Color.white; GUILayout.EndHorizontal(); CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray); GUILayout.Space(15); if (isAI.boolValue) { EditorGUILayout.PropertyField(aiBehaviour); GUILayout.Space(10); CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray); } else { EditorGUILayout.PropertyField(inputHandlerSettings); GUILayout.Space(10); } GUI.enabled = false; EditorGUILayout.PropertyField(characterActions, true); GUI.enabled = true; GUILayout.Space(10); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); CustomUtilities.DrawScriptableObjectField <MaterialsProperties>((MaterialsProperties)target); CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray, 8); EditorGUILayout.LabelField("Default material", EditorStyles.boldLabel); EditorGUILayout.HelpBox("A default material parameter corresponds to any ground or spatial volume without a specific \"material tag\". " + "A Surface affects grounded movement, while a Volume affects not grounded movement.", MessageType.Info); GUILayout.Space(10); CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray); EditorGUILayout.LabelField("Default surface", EditorStyles.boldLabel); CustomUtilities.DrawArrayElement(defaultSurface, null, true); CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray); EditorGUILayout.LabelField("Default volume", EditorStyles.boldLabel); CustomUtilities.DrawArrayElement(defaultVolume, null, true); // -------------------------------------------------------------------------------------------------------- GUILayout.Space(10); CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray); EditorGUILayout.LabelField("Tagged materials", EditorStyles.boldLabel); GUILayout.Space(10); CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray, 8); EditorGUILayout.LabelField("Surfaces", EditorStyles.boldLabel); CustomUtilities.DrawArray(surfaces, "tagName"); CustomUtilities.DrawEditorLayoutHorizontalLine(Color.gray, 8); EditorGUILayout.LabelField("Volumes", EditorStyles.boldLabel); CustomUtilities.DrawArray(volumes, "tagName"); serializedObject.ApplyModifiedProperties(); }