Why is Editor not persisting programmatic changes even when using EditorUtility.SetDirty()

Ok I have an editor script. It loops through all the doors in my level and assigns them unique ID’s. Now, I know that changes made by script need to be regiestered so they are correctly saved so I am using both EditorUtility.SetDirty() and Undo.RegisterCompleteObjectUndo(). Originally I was just using the undo one but it wasn’t saving so I added the SetDirty(). Now here’s where things are breaking. When I run the command, the little * correctly appears at the top of the unity window indicating that the editor knows something has changed. Then I hit save, and the star goes away as expected. Then when I reload the scene, all of the changes are reverted!

What am I doing wrong? I thought registering the undo or calling set dirty was all I had to do to persist the change.

My Code:

#if UNITY_EDITOR
[CustomEditor(typeof(DoorManager))]
[CanEditMultipleObjects]
public class DoorAssignerEdtiro : Editor
{
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        GUILayout.BeginVertical();

        if (GUILayout.Button("Assign IDs"))
        {
            DoorOpener[] Doors = GameObject.FindObjectsOfType<DoorOpener>();
            for (int i = 0; i < Doors.Length; i++)
            {
                EditorUtility.SetDirty(Doors*.gameObject);*

Undo.RegisterCompleteObjectUndo(Doors*.gameObject, “Updating Door ID”);*
Doors*.DoorID = System.Guid.NewGuid().ToString();*
Debug.Log(Doors*.DoorID);*
}

//Validate
for (int i = 0; i < Doors.Length; i++)
{
for(int j = 0; j < Doors.Length; j++)
{
if(i != j && Doors*.DoorID == Doors[j].DoorID)*
{
Debug.LogError(“Doors " + Doors*.name + " and " + Doors[j].name + " Have matching IDs!”);*
}
}
}

Debug.Log(Doors.Length + " Door Id’s Assigned");
}

GUILayout.EndVertical();
}
}
#endif

Well… I feel stupid. Figured it out. I was doing:

EditorUtility.SetDirty(Doors*.gameObject);*
when I needed to be doing
EditorUtility.SetDirty(Doors*);*
The parameter is a Unity.Object, not a GameObject like I thought it was. So I needed to supply it with the component that was actually being changed.