utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEditor;
utilizing UnityEditorInternal;
utilizing UnityEngine;
[CustomEditor(typeof(DialogueTrigger))]
public class DialogueTriggerEditor : Editor
{
personal SerializedProperty _conversations;
personal void OnEnable()
{
_conversations = serializedObject.FindProperty("conversations");
}
public override void OnInspectorGUI()
{
//base.OnInspectorGUI();
serializedObject.Replace();
_conversations.arraySize = EditorGUILayout.IntField("Conversations Dimension", _conversations.arraySize);
for (int x = 0; x < _conversations.arraySize; x++)
{
var dialog = _conversations.GetArrayElementAtIndex(x);
var conversationName = dialog.FindPropertyRelative("conversationName");
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(conversationName);
EditorGUI.indentLevel++;
var _dialogues = dialog.FindPropertyRelative("Dialogues");
_dialogues.arraySize = EditorGUILayout.IntField("Dialogues measurement", _dialogues.arraySize);
for (int i = 0; i < _dialogues.arraySize; i++)
{
var dialogue = _dialogues.GetArrayElementAtIndex(i);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(dialogue, new GUIContent("Dialogue " + i), true);
EditorGUI.indentLevel--;
}
if (_dialogues.arraySize > 0)
{
if (GUILayout.Button("Save Dialog"))
{
}
}
EditorGUI.indentLevel--;
}
serializedObject.ApplyModifiedProperties();
}
}
I am utilizing in some locations the EditorGUI.indentLevel++; however the result’s this:
However I would like it to be like this:
Conversations Dimension
Dialog Identify
Dialogue measurement
Dialog Identify
Dialogue measurement
Dialog Identify
Dialogue measurement
Dialog Identify
Dialogue measurement
That is the way it ought to appear like within the Inspector.
The issue is on this half:
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(conversationName);
EditorGUI.indentLevel++;
var _dialogues = dialog.FindPropertyRelative("Dialogues");
_dialogues.arraySize = EditorGUILayout.IntField("Dialogues measurement", _dialogues.arraySize);
I can not make the “Dialog” Identify the “Dialogues” and the “Dialogues measurement” the identical as I wished.
The “Dialogues” is okay however the others are usually not.