Character with weapon, texturing problem

Hello there !

I’m facing a problem and I can’t find the solution by myself.
So, I have a character made of an object containing 2 mesh, one for the body himself and an other one for a sword (that is attached to the hand of the character by the armature)

each has its UV map

If I put my object on the scene, I can apply a material to the body, and an other one to the weapon. But I make this character spawn into the game from a script, so I have to “attach” the textures on these objects I think.

So I started to click on the sword, then click the “select” button in the inspector panel and I applied the texture from here and do the same for the body. But, the last texture I “attached” to one or other mesh is also applied to the other as the same material :o

I’m not sure if my explanation is clear ^^

How can I solve that? how can I cut off the dependencies or something? Maybe my approach is the bad one?

Thank you for your replies :slight_smile:

Sorry if I misunderstand, but do you have separate materials for the sword and the character? You should have 2 separate materials, one for the sword and one for the character.

Also, you don’t have to have attach the materials to the object if you are spawning it in. You can put the character in a prefab and spawn the prefab.

Yes I have 2 materials :smile: sorry, English is not my native language ^^

Yes! The prefab is the solution, that’s simple ^^ but this is my first project on unity and I didn’t know that the prefabs was that simple :smile:

Thank you for your help KingMatthew ^^ I hope to see you around, next time I get stuck ^^