Skip to content

Commit

Permalink
fix: reading namespace from file OnEnable
Browse files Browse the repository at this point in the history
  • Loading branch information
brunomikoski committed Dec 14, 2022
1 parent 38d1bfc commit f05cb79
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions Scripts/Editor/Core/CollectionCustomEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void OnEnable()
CheckGeneratedCodeLocation();
CheckIfCanBePartial();
CheckGeneratedStaticFileName();
ValidateGeneratedFileNamespace();
editorInstance = this;
}

Expand Down Expand Up @@ -664,6 +665,21 @@ private void DrawGeneratedFileName()
}

private void DrawGeneratedFileNamespace()
{
SerializedProperty fileNamespaceSerializedProperty = serializedObject.FindProperty("generateStaticFileNamespace");

using (EditorGUI.ChangeCheckScope changeCheck = new EditorGUI.ChangeCheckScope())
{
string newFileName = EditorGUILayout.DelayedTextField("Namespace", fileNamespaceSerializedProperty.stringValue);
if (changeCheck.changed)
{
fileNamespaceSerializedProperty.stringValue = newFileName;
fileNamespaceSerializedProperty.serializedObject.ApplyModifiedProperties();
}
}
}

private void ValidateGeneratedFileNamespace()
{
SerializedProperty fileNamespaceSerializedProperty = serializedObject.FindProperty("generateStaticFileNamespace");
if (string.IsNullOrEmpty(fileNamespaceSerializedProperty.stringValue))
Expand All @@ -678,16 +694,6 @@ private void DrawGeneratedFileNamespace()
}
}
}

using (EditorGUI.ChangeCheckScope changeCheck = new EditorGUI.ChangeCheckScope())
{
string newFileName = EditorGUILayout.DelayedTextField("Namespace", fileNamespaceSerializedProperty.stringValue);
if (changeCheck.changed)
{
fileNamespaceSerializedProperty.stringValue = newFileName;
fileNamespaceSerializedProperty.serializedObject.ApplyModifiedProperties();
}
}
}

private void DrawAutomaticallyLoaded()
Expand Down

0 comments on commit f05cb79

Please sign in to comment.