- Home /
Cannot make another prefab of same model
I have this model in unity https://www.assetstore.unity3d.com/en/#!/content/4331
What I want to do is make one red samurai as the player and I want the same model to be as a prefab but with blue tinted texture instead. I managed to copy the base texture and use color balance in Gimp to change the red parts into blue, so now I have a blue texture. I also created a material with this new blue texture.
The problem I have is when I change material on the Blue Samurai to be with the blue texture it also changes the texture on the Red Samurai though I have those two game objects as a prefabs as well. I guess I change the exact same subobject of the red and blue samurai that is holding the body of the samurai. If I select the body subobject and then press right click -> "select prefab" on "plane007" it shows on the same exact prefab subobject holding the body of the samurai
How can I separate and make two prefabs with different texture/material?
I cannot see "duplicate" button in the prefabs folder.
Answer by spinnerbox · Sep 23, 2015 at 02:38 PM
Probably this is a noob question but at the time I was confused what do I do wrong. I found an even better way to assign different material to the two Samurais. If you check the images carefully, they have Skinned Mesh renderer which allows you to select different material. I did tried that and now I have two different Ninjas, blue and red.
I would keep it just so somebody learning Unity might find this question useful. But yes above solutions work as well.
This method is actually much better. It will batch the meshes and optimise the performance. But if you want to generate the prefabs dynamically, it could be complicated.
Answer by sys12 · Sep 22, 2015 at 01:03 PM
Attach script to your prefab with 2 public fields like:
public Material m_material;
public Texture2D m_texture;
And apply them to your mesh renderer. Drag your textures and materials to the script of each gameobject created by prefab in editor.
Answer by LessThanEpic · Sep 22, 2015 at 01:05 PM
Two things.
1) To make a new prefab click one of the game objects in the hierarchy pane and drag it into the project pane.
2) Make sure the two prefabs are using different materials. In the Skinned Mesh Renderer component there's a Materials section. If both game objects are pointing to the same material then they're going to be the same color, regardless of whether or not they have different prefabs.