Big stupid refactor of spawning almost done

This commit is contained in:
Michal Pikulski
2025-12-17 18:51:33 +01:00
parent 7a598c302c
commit 867399c838
32 changed files with 1450 additions and 403 deletions

View File

@@ -181,28 +181,38 @@ namespace AppleHills.Core.Settings.Editor
return;
}
SerializedObject serializedObj = serializedSettingsObjects[typeof(T).Name];
serializedObj.Update();
EditorGUILayout.Space(10);
// Draw all properties
SerializedProperty property = serializedObj.GetIterator();
bool enterChildren = true;
while (property.NextVisible(enterChildren))
// Use CreateEditor to respect custom editors (like AirplaneSettingsEditor)
UnityEditor.Editor editor = UnityEditor.Editor.CreateEditor(settings);
if (editor != null)
{
enterChildren = false;
// Skip the script field
if (property.name == "m_Script") continue;
EditorGUILayout.PropertyField(property, true);
editor.OnInspectorGUI();
DestroyImmediate(editor);
}
// Apply changes
if (serializedObj.ApplyModifiedProperties())
else
{
EditorUtility.SetDirty(settings);
// Fallback to default drawing if no custom editor exists
SerializedObject serializedObj = serializedSettingsObjects[typeof(T).Name];
serializedObj.Update();
SerializedProperty property = serializedObj.GetIterator();
bool enterChildren = true;
while (property.NextVisible(enterChildren))
{
enterChildren = false;
// Skip the script field
if (property.name == "m_Script") continue;
EditorGUILayout.PropertyField(property, true);
}
// Apply changes
if (serializedObj.ApplyModifiedProperties())
{
EditorUtility.SetDirty(settings);
}
}
}