PropertyDrawer OnDestroy() ?

Hello,

So I am using ScriptableObject assets that are being created along with my property drawer. The reason for this is so I can easily “serialize” values like object[ ] and other custom classes. I found this to be a lot cleaner than using Json serialization. I also like being able to manipulate other fields right in the project without digging through scenes to change variables.

The issue is, when I delete my Monobehaviour that contains my property drawer, the asset is still sitting in my project folder destination.

When I didn’t have this class as a property drawer earlier, I could destroy the asset with the OnDestroy method. Any way of detecting if a propertydrawer has been destroyed? Or detecting if the root monobehaviour has been destroyed?

Any help appreciated!

Thanks,

My thought is that you would want to hook an editor to listen to Unity - Scripting API: EditorApplication.hierarchyWindowChanged and figure out if any of your scriptable objects have been orphaned.

1 Like