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

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.

Where can we find the exact .meta file to delete? I’m having this same problem with some different fbx files, prefabs, etc.