- Home /
In Unity 5, how do I replace files instead of appending "1" and duplicating?
In unity 4, when importing a package it would overwrite any existing files with the same name. In Unity 5, it creates a new file like "filename 1". How do I make it overwrite existing files instead of keeping both?
I'm running into the same issue. Having the filenames have " 1" after them makes it much more difficult to update a .unitypackage that I'm already using.
I tried importing "unitypackage" in 3 different ways:
-Directly click on it while project is opened
-Through assets store
-Project view => R$$anonymous$$B => Import package => Custom package
I couldn't replicate the issue with any of those methods above^. None of the preference assets checkboxes could cause this issue either.
Have you done anything else to your Unity editor after installation? Some plugins, extensions?
No, this was a fresh install of Unity. I tried by double clicking on the package while my project was open, and also doing Assets > Import Package > Custom Package. You were using Unity 5 @DoTA_$$anonymous$$A$$anonymous$$I$$anonymous$$ADzE ? I'm not using prime 31, but I see them making note of this same issue in their release notes (search for "space 1" in there).
One thing to note was that the packages had to be different in some way to cause the duplicate files. If I import the exact same .unitypackage twice, then there are no files to import. But if I have version 1 of a .unitypackage and version 2 of a .unitypackage, then the 1
behavior happens. It happens for all files in the package, regardless of whether or not a particular file changed between version 1 and 2 of the plugin
Tried with different package versions, different locations and even renamed package to something else. Still can't replicate your issue. And yes I'm using Unity 5 (5.0.1f1) everything was also fine on 5.0.0f4 version as well.
Answer by christo17452 · Apr 20, 2015 at 02:51 PM
@maxgabriel yes I'm still having the issue. Not every time though. Importing unity packages seems to work more often than updating prime31 plugins
@christo17452, I think it's only updating that has problems. I added new/fresh packages in Unity5 recently and didn't have a problem. Only when it's a package update with existing files.
Answer by ferretnt · May 14, 2015 at 06:54 PM
I'm also seeing the same thing. It is beyond infuriating. Still, 5.0 did get us a projectsettings.asset that finally serializes as text, so it's not all bad...
Answer by Denvery · Jun 08, 2015 at 11:43 AM
May be this discussion will be helpful: http://forum.unity3d.com/threads/unity5-and-custom-packages-imports.311807/
To implement replacing meta-files need to stay identical:
for file that will be replaced
replacing file
Please post what are you doing? $$anonymous$$ay be I can help you, because I've solved this problem
I've replaced you on the forum: You need delete old ones, but only IN FILESYSTE$$anonymous$$, not in Unity editor. In this case (filesystem) meta-files remains corrected, but content files replaced as we need.
Answer by xu li · Aug 29, 2015 at 12:08 AM
I fixed my problem by writing a python script to do the job (tranverse and overwrite old file with new file that ends with " 1" or appended number) after importing plugins:
Your answer
![](https://koobas.hobune.stream/wayback/20220613190502im_/https://answers.unity.com/themes/thub/images/avi.jpg)