- Home /
Question by
peXed · Aug 04, 2015 at 04:15 PM ·
editorprefabeventsassetdatabase
A event on deletion of asset in the asset database?
Hello!
Is it possible to run a script, if a (specific) object gets deleted in the Project (AssetDatabase) window?
So for example, if a Prefab gets deleted a editor script will run and update other prefabs?
Comment
Best Answer
Answer by peXed · Aug 05, 2015 at 08:08 PM
I found the solution!
There seemse to be two ways.
One is to use the AssetModificationProcessor (AssetModificationProcessor.OnWillDeleteAsset())
With this, you can directly hook into the delete process. This is a pro feature only.
The second way and the solution for me (because I don't want to change the way Unity is deleting assets) is to use the AssetPostprocessor. With AssetPostprocessor.OnPostprocessAllAssets you get a list of all deleted assets from Unity.
This is exactly what I was looking for!