in Scripts/Editor/Data/Configuration/WitConfigurationEditor.cs [237:300]
protected virtual void LayoutConfigurationRequestTabs()
{
// Indent
EditorGUI.indentLevel++;
// Iterate tabs
if (_tabIds != null)
{
GUILayout.BeginHorizontal();
for (int i = 0; i < _tabIds.Length; i++)
{
// Enable if not selected
GUI.enabled = requestTab != i;
// If valid and clicked, begin selecting
string tabPropertyID = _tabIds[i];
if (ShouldTabShow(configuration, tabPropertyID))
{
if (WitEditorUI.LayoutTabButton(GetTabText(configuration, tabPropertyID, true)))
{
requestTab = i;
}
}
// If invalid, stop selecting
else if (requestTab == i)
{
requestTab = -1;
}
}
GUI.enabled = true;
GUILayout.EndHorizontal();
}
// Layout selected tab using property id
string propertyID = requestTab >= 0 && requestTab < _tabIds.Length ? _tabIds[requestTab] : string.Empty;
if (!string.IsNullOrEmpty(propertyID) && configuration != null)
{
SerializedObject serializedObj = new SerializedObject(configuration);
SerializedProperty serializedProp = serializedObj.FindProperty(propertyID);
if (serializedProp == null)
{
WitEditorUI.LayoutErrorLabel(GetTabText(configuration, propertyID, false));
}
else if (!serializedProp.isArray)
{
EditorGUILayout.PropertyField(serializedProp);
}
else if (serializedProp.arraySize == 0)
{
WitEditorUI.LayoutErrorLabel(GetTabText(configuration, propertyID, false));
}
else
{
for (int i = 0; i < serializedProp.arraySize; i++)
{
SerializedProperty serializedPropChild = serializedProp.GetArrayElementAtIndex(i);
EditorGUILayout.PropertyField(serializedPropChild);
}
}
serializedObj.ApplyModifiedProperties();
}
// Undent
EditorGUI.indentLevel--;
}