Apply changes on asset to instance

I have a custom editor displaying some properties of my custom class “Room” in the inspector.

Whenever I change one property on the asset all the instances are updated automatically. Unless of course I have overriden that specific property on the instance.
Now I would like to make sure that whenever I change the property on the asset, all instances are updated regardless of whether they are overriden or not. But I don’t know how to find all the respective instances in the scene in order to change them.
So my question is how does Unity do it? It needs to find all instances and update them somehow once an asset is changed. And how could I do it?

Thank you for your help.

I guess you could use Object.FindObjectsOfType() to get all objects with that component, then use PrefabUtility methods.

You can make sure the object is an instance of the prefab you’re editing using GetCorrespondingObjectFromSource.
You can make sure the instance is still connected to the prefab with IsDisconnectedFromPrefabAsset.

Once you confirmed it’s a connected instance of the prefab you can change the value, but you probably need to get the serializedObject for that instance if you want the changes to be persisted: Unity - Scripting API: SerializedObject

Anyway, all this sounds like a really bad idea, you’ll be doing exactly the opposite of what prefab overrides are intended to do. It might be better if you make a script that checks all prefab instances of the scene on reverts the properties that are not supposed to be overriden. Check other methods of PrefabUtility, like: Unity - Scripting API: PrefabUtility.RevertPropertyOverride

With this approach you can run the script when you open a scene and it’ll “fix” any prefab instance overriding those values on the scene. The other solution will only work on objects on currently open scenes.