Alright, I’ve probably just come across the most destructive Unity editor behaviour I ever have so I feel the need to gripe about it a little.
As I was working on my project, I deleted a script I thought I wasn’t using anymore, which was a mistake on my part. No biggy, Unity just sends scripts that get deleted to the recycle bin as any good program would. After realising I had deleted the wrong script, I navigated to the recycle bin, right clicked on the file and hit “restore.” After all, I drag and drop files into my asset folder all the time and have no problems with that.
That’s when the S*** hit the proverbial fan.
Instead of accepting the script back into the assets folder, unity threw out an Assertation failed error and completely annihilated the script. This behaviour, to me at least, seems needlessly destructive and counterintuitive. It’s not just a one-off thing, either! I created numerous test scripts, both attached and not attached to other objects, and the behaviour was the exact same. This is absolutely a Bad Thing To Do, and yet Unity does it. The only way around it is to restore the script to another folder entirely, then drag it into the assets folder, which is needlessly overwrought.
Take this thread as both a warning to users and a suggestion to the Unity team: do not destroy files when being restored from the recycle bin.