- Home /
How can you duplicat folders and not share old dependencies?
Hi guys!
I have a folder with some prefabs, materials, textures, FBX, etc. My Prefabs refers to FBX and Materials in this folder. Can I clone this folder in a way that it will save those local dependencies?
For example:
BaseFolder is located: Assets/BaseFolder
It contains a prefab: Assets/BaseFolder/Prefab.Prefab
Prefab is linked to a material: Assets/BaseFolder/Material.MAT
Tha material is liked to a texture: Assets/BaseFolder/Texture.TGA
Now I duplicate or clone BaseFolder and rename it CloneFolder. This is what my dependencies should look like:
Folder is located: Assets/CloneFolder
It contains a prefab: Assets/CloneFolder/Prefab.Prefab
Prefab is linked to material: Assets/CloneFolder/Material.MAT
The material likes to texture: Assets/CloneFolder/Texture.TGA
But, by default, when I dublicate folders dependencies refers to the old resources with old paths.
Here's what it looks like:
CloneFolder is located: Assets/CloneFolder
It contains a prefab: Assets/CloneFolder/Prefab.Prefab
Prefab is linked to a material: Assets/BaseFolder/Material.MAT
Tha material is liked to a texture: Assets/BaseFolder/Texture.TGA
You can see By the bolded text where the issue is. I really need my new folders to be independent.
I can do it manually in editor for every object. But I have many objects and many dependencies, and I need to automate this process.
Could there be import setting within unity to deal with importing prefabs? There are some for every other imported asset: Textures, Models, Animation, etc. Hopefully there is a graceful solution to this.
I've tried quite a few tricks, such as exporting my package and importing it. renaming FBXs and Materials, even deleting meta files and duplicating in windows rather then using Unity and nothing works.
Rosalie M.
I even tried saving over files such as textures, materials, FBX's and name them differently, but the problem remains it will always know that they are old dependencies.
The reason why this is a major issue is because if someone buys two of my 3D assets packages and tries to import them both, prefabs will be referring to bad textures and $$anonymous$$eshes. I cant have such a flaw in my packages.
So of what I understand, there must be an ID inside the prefabs and textures that gets created as soon as the object is placed into the unity folder. That ID will not change no mater what and this is what keeps those links. $$anonymous$$y question now is, is it possible to make a script that could strip that id and issue a new one to the selected items? bear in $$anonymous$$d that I have very $$anonymous$$imal knowledge in the scripting field.
Answer by sh_code · Jan 13, 2019 at 09:22 PM
You can't. That's the point of prefabs and dependencies. They stay what they were regardless of where and how you copy or move the prefabs. That is the whole point of dependencies.
You can write an editor script which will change them, though.
Your answer
Follow this Question
Related Questions
Possible Unity Glitch. A few lines of code erasing prefab data. 1 Answer
Apply new complex fbx to saved prefab 0 Answers
Prefab Materials and Meshes being deleted, How can I stop this 1 Answer
duplicate a prefab then change the model? 1 Answer
Generated meshes/materials cannot be made into prefabs? 1 Answer