- Home /
How do I change the color of imported blender models
So I imported some blender models and they have the mesh made as a child of the prefab. I want to use a script attached to the prefab to change the color around. How can I do that?
Answer by DesiQ · Sep 13, 2012 at 09:01 PM
You can change colors at runtime without needing unique materials.
renderer.material.SetColor ("_Color", yourColor);
This changes the diffuse color channel for only that particular instance, and no others. I used it in a puzzle game where I had blocks that were colored individually at runtime, then pulsed different colors when hovered over.
Answer by PProductions · Sep 13, 2012 at 05:37 PM
Make sure that the child has a dedicated material, then use renderer.material.color to change the colour of it. If you are using textures make sure that the texture is in greysacle so different colours can be applied to it.
when you say dedicated material do you mean I need every single child to have there own material? So I need to make a material and attach it for each game object?
Are you sure thats sorta retarded.