Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback AssetModificationProcessor.OnWillDeleteAsset behaviour change

Discussion in 'Editor & General Support' started by HarryCodder, Feb 10, 2021.

  1. HarryCodder

    HarryCodder

    Joined:
    Feb 20, 2015
    Posts:
    84
    Hello everyone,

    Between Unity 2019.1 and 2019.4, the behaviour of AssetModificationProcessor.OnWillDeleteAsset has changed when returning AssetDeleteResult.FailedDelete.

    Before, nothing happened or a log was maybe displayed notifying the "failure".
    Now, a dialog box is shown with the message "Some assets could not be deleted. Make sure nothing is keeping a hook on them, like a loaded DLL for example".

    I think this change is ill advised and that the dialog box should only be shown if the Unity internal code is the one failing to delete the asset.
    If an implementation of AssetModificationProcessor.OnWillDeleteAsset returns AssetDeleteResult.FailedDelete, it should be its responsibility to display a dialog box if necessary.
    In my case, I want to return AssetDeleteResult.FailedDelete to prevent the deletion of assets in some cases. Thus I display a dialog box notifying the user that the asset cannot be deleted at this time. And then the new dialog box shows up giving a completely irrelevant message.

    I filed a bug report about that but was redirected to the forums.
    I hope a Unity developer will see this then.

    Thanks in advance.