- Home /
Undo asset replace? *emergency D:*
I imported prefabs from the asset store and it contained a script I already had named that, so naturally Unity replaced it without even telling me and I lost all progress on that script. Is there a way to undo this, or maybe a way to get unitron to pull a backup somehow? Thanks, this is project-threatening stuff...
Using $$anonymous$$ac OS 10.6.8 :/ and yeah I was just about to make a backup :/ looks like I'll have to rewrite the biggest and most important 700 line script ;_; and I don't even remember most of it
That's a pity! I do not know of an OS X alternative. Perhaps the Time $$anonymous$$achine feature can help you?
I have time machine and it literally just ran out of space :/
Search your project folder for compiled DLL files like ("Assembly-CSharp.dll"). I believe that you might be able to recover your source code (without comments) from there. Though I do not know how to do this, perhaps somebody else could assist if they know?
This isn't an answer, more a suggestion to help prevent this headache for you in the future.
All flavors of Unity will let you select Edit->Project Settings->Editor from the menu and set Version Control to "$$anonymous$$eta Files".
$$anonymous$$y issue with version control was space since games have both assets and code. I use bitbucket.org to host my git repos and just stuff everything into them both code and non-code. They offer unlimited private repos and unlimited space for free (up to 5 users).
The last detail is remember to add the Library folder to .gitignore since it will be built by the meta files you activated earlier.
I'm sorry this doesn't fix your current problem but hopefully it will save you in the future.
Answer by SomeGuy22 · Feb 25, 2013 at 06:30 PM
Well I've found a solution... not the best but better than rewriting the entire code from memory. I got my friend (running Windows) to open Assembly-UnityScript.dll from a built program with ILSpy and found the script. It was converted to an unusable version of C#, meaning all I have to do is translate it to usable javascript with my own knowledge. It's a shame that I have to do all that extra work for what could've been avoided with a simple undo button -_-
As an asset provider I have asked for this several times. I want a warning message to appear before importing any asset. You will find that many asset providers include warnings everywhere they can (readme, documentation, website, blog, release notes, etc.) but unfortunately those are not pro$$anonymous$$ent enough for people who just click the "Update/Import" button.
For example, special upgrade notices, or even generic "backup because you never know!" messages.
It's very easily done though, sometimes a gentle re$$anonymous$$der is refreshing. $$anonymous$$y only advice for the future is to backup your work at least once a day.
Remember, you could get a virus/hacked also, so it is generally good advice. Preferably store your backups on an external media.
Thanks for helping. I'll search around to see if I ever took video of the script or a screenshot, or even parts of it on unity forums and answers probably... Unity needs an undo system badly :P
Answer by numberkruncher · Feb 25, 2013 at 06:29 PM
This is why you should always backup your files regularly, and also before updating/installing any packages from the asset store!
If you are using source control, then you will probably be able to recover from a previous commit.
If you are using Windows Vista/7 then you might be able to try this trick.
Right-click the new script using Windows Explorer and select "Properties".
Select the "Previous Versions" tab.
Wait a few seconds for the list to populate.
If you are lucky, then a previous version will appear.
Answer by davedev · Feb 25, 2013 at 06:31 PM
Are you on mac or windows? On mac I think "replaced" files are moved to the trash so you might be able to retrieve it from there. Same might be true on Windows. Its a file level operation and really doesn't have anything to do with Unity i.e. the script isn't stored in Unity I think. So you are looking at operations to recover a deleted file.
Replaced files are not moved to trash, they are "replaced" completely overwritten
Your answer
Follow this Question
Related Questions
Why does the Editor open random folders in Project at startup? 2 Answers
Undo - mandatory for editor tools? 1 Answer
How to increase the size of my sprites in the Editor > Project previsualization? 0 Answers
Tell difference between Undo & Redo on callback 0 Answers
Error when starting new project 0 Answers