- Home /
assets in package overwriting files they shouldn't
Hi all,
I posted this on the Unity forum and got one workaround but I was wondering if anyone here had another solution to what I would imagine is a fairly common problem?
Here is the thread:
Me: Hopefully a simple answer to this. Say I have Unity project A that contains ScriptA. I then use that script in Unity Project B, modify it and rename it ScriptB. When I export the assets in Project B as a package and try to import them back into Project A, Unity wants to overwrite Script A with script B even though I have made many changes to the file and changed the name. How can I break the connection to the original file so ScriptB is added to Project A?
Response: Create a new js file, copy paste all the content ?
Me: ok that worked, which is nice to have a workaround - thanks.
does anyone have a more elegant solution? The problems with the current workaround are:
a) it is difficult to know which files unity will want to add or replace without going through the whole export/import package first. b) when you create a new script you have to reapply it to all the game objects that utilise the original script.
Thanks in advance
I'm having much the same problem... renamed scripts get overwritten with the prior name as if there's something in Unity that tokenizes the assets with the original name.
This posted workaround is helpful - for scripts. But the same thing is happening to my scenes and prefabs. I'm pretty irritated and frustrated.
I've gone to the trouble of rena$$anonymous$$g everything and resolving all the errors that creates in the scripts, but the overwrites are still happening on import into the the other project.
Have the same problem as well. $$anonymous$$ost annoying, wasted several hours trying to find a work around for things other than scripts.
This is a fairly common problem.... I just ran into it - so annoying. I wish to see better workarounds.
I have just run into this problem, hours of work has been waste, I have to reedit the scripts again...
Answer by MadDave · Oct 26, 2012 at 12:45 PM
When you renamed ScriptA to ScriptB, you should have deleted the ScriptA.meta file. The meta-file contains a unique id that allows unity to recognize the file even though the file name has changed.
This feature is actually very important; imagine you have a game with several scenes (levels) and all of them use some prefab. Now the prefab gets renamed - are all of your levels broken now? No, they are not - thanks to the unique id in the meta file all scenes will find the prefab again.
Answer by qjermyn · Jan 28, 2013 at 06:27 AM
Where can we find the exact .meta file to delete? I'm having this same problem with some different fbx files, prefabs, etc.
Unitys Project panel hide them from you, just right click and 'Show in Explorer' where you see the corresponding meta files.