Hi all, I cant figure out why my editor script isnt marking the scene as dirty. If I use it, I have to manually do something else in the level before I save it, and that’s a touch annoying.
Why doesnt my script work the way its intended?
[CustomEditor(typeof(LevelManager))]
public class GenerateID : Editor {
public override void OnInspectorGUI()
{
EditorGUI.BeginChangeCheck();
if (GUILayout.Button("Generate ID's"))
{
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Created Unique GUI");
GenerateIDs();
}
}
if (GUI.changed)
{
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
}
DrawDefaultInspector();
}
public void GenerateIDs()
{
LightManager[] lightscripts = FindObjectsOfType<LightManager>();
for (int i = 0; i < lightscripts.Length; i++)
{
lightscripts*.uniqueID = generateString();*
EditorUtility.SetDirty(lightscripts*);*
}
}
Any help would be greatly appreciated.