- Home /
Question by
AlienClubrider · Aug 11, 2013 at 03:22 AM ·
material color
how do you change the color of a prefab?
I want to change the color of a prefab when I instantiate it.
Comment
Change the color of the actual object or the highlight of the prefab objects shown in the inspector.
Answer by porl · Aug 11, 2013 at 05:26 PM
Make sure the prefab already has a material on it and then:
GameObject thing = Instantiate(prefabToInstantiate) as GameObject;
thing.renderer.material.color = Color.red;
Your answer
![](https://koobas.hobune.stream/wayback/20220613111944im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Erratic DrawCall batching behavior, I'm going crazy 0 Answers
Changing mesh shader not working iOS 0 Answers
Emissive Material control via script (code) 1 Answer
Simple Color Shader for 3D Models 0 Answers
Set Specific Child's Material 2 Answers