How to set dirty a class from an interface

Hey all,

I’m editing some variables inside a class and I have created an interface in order to edit variables in a generic way. However it seems that EditorUtility.SetDirty doesn’t work without the specific instance of the class so I can’t apply the new values.

Is there a way to do this or do I have to try every class it implements that interface?

I decided to change my code structure to use ScriptableObject instead, so I solved it like that.

Hi, if someone still searching for answer.

If your Interface is inherited from MonoBehaviour, you can make like this:

EditorUtility.SetDirty(InterfaceObject as MonoBehaviour);
1 Like