Unexpected response from Unity with AssetMoveResult (AssetModificationProcessor.OnWillMoveAsset)
I'm using Unity 5.6, I've got an AssetModificationProcessor extended class which helps me in organizing my assets.
With the static method OnWillMoveAsset(string from, string to), you must return an enum value from AssetMoveResult. The possible values are DidMove, DidNotMove and FailedMove
You'd expect on moving an asset, returning AssetMoveResult.DidNotMove would internally prevent Unity from moving the asset in question, but it doesn't.
It appears the 2 values DidMove and DidNotMove are back to front. To allow the asset to be moved freely I must return DidNotMove, against all reason.
In a scenario where I don't want the asset to be moved I return FailedMove, but DidMove does something similar - both prevent the asset from being moved.
So... what's going on here? Is it a bug or is there some strange twisted logic behind this? In looking for an answer all I came across was this single man's plaintive tweet:
Answer by AlasYorick · Apr 09, 2020 at 09:56 PM
I was stumped by this for a couple hours, but I eventually realized that DidMove means that your custom script moved the asset itself, so Unity shouldn't do anything with it, and DidNotMove means your script didn't move the asset, so Unity should move it as normal.