- Home /
Having a model with diferent textures in unity
I have a 3D model and I want to have on editor twice with two diferent textures.
I have tried to put the same model twice on the editor, and change in one of them the texture, but if I do this, it's changed in both models.
What I can do?
Answer by runonthespot · May 26, 2011 at 11:43 AM
I think the easiest way is to make two prefabs from the model and change the material in each prefab. I think, also, if you drag the model onto the scene once, then select it in the scene and choose "duplicate", you can change the materials independently.
Finally, you can also alter the material on the gameobject directly at runtime. It really depends what you're trying to do.
Uhmm I want to have two enemies, with the same model but with diferent texture, for example: 1 green dinosaur and 1 red dinosaur. I have textures not materials, I don't know exactly how it works >__<''
Start with an empty project. Import a 3d model and a texture. Drop the model onto the scene and then the texture onto the model. You will notice that a "materials" folder appears under your project assets. This material basically says: Use this texture on the model, and render it with "Diffuse" shader (Default).
Now in the project view, right-click, create new prefab. Drag the $$anonymous$$odel from your scene hierarchy onto the blank prefab. (it should go from grey to blue).
Now if you drag that prefab onto the scene, it will have your model and a material already added.
Right. So in the project view, create a second prefab, and do exactly the same process. Now you can click on the prefab in your Project assets, and change the texture on its material.
Drop either prefab onto the scene to create the "red" or "blue" dinosaur.
Glad to hear it. I recently solved this issue with scripts too- you can dynamically assign materials at runtime which is awesome if you want some randomness (100 animals, 6 variations for example :). I'm on twitter as @runonthespot or here if the details of that are of interest.
Your answer
Follow this Question
Related Questions
Jagged and blurry texture on model 1 Answer
Black marks glitching in model 0 Answers
How to spawn a model with texture? 1 Answer
Texture not woking with any FBX model imported from Blender. 2 Answers