UnityEditor.AssetModificationProcessor OnWillMoveAsset not getting called

I’m trying to run my own function when an asset is moved or renamed so I have created a new class extending from UnityEditor.AssetModificationProcessor and implemented OnWillMoveAsset as follows:

public static AssetMoveResult OnWillMoveAsset(string oldPath, string newPath)
    {
        Debug.Log("Asset moved");
        return AssetMoveResult.DidMove;
    }

However this does not seem to be called.
Is there anything I’m missing? Any help will be appreciated :slight_smile:

Ran into the same issue. Looks like it does work in Unity Pro, but not Personal edition (verified using 5.3.4p6).

I suspect Unity simply overlooked this. It’d be a bummer if it’s intentional :frowning:


An alternative would be using AssetPostprocessor, however it is called after the asset is moved, not before. So depending on what you are using it for, it might or might not suit your purpose:

[InitializeOnLoad]
public class MyAssetPostProcessor : AssetPostprocessor
{
    public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        for (int i = 0; i < movedFromAssetPaths.Length; i++) {
            Debug.Log("Moved Asset from " + movedFromAssetPaths _+ " to " + movedAssets*);*_
 _*}*_
 _*}*_
_*}*_
_*```*_