- Home /
How to change the color of all objects that use the same material?
Is there any means to change the color of multiple objects that use the same material? I cannot call it by multiple scripts due to optimization since there is many similar objects and the function I need for changing the color is called constantly. I know that sharedMaterial works for that matter, but it only works in the editor mode, not in a build, at least for me, perhaps am I missing something. Can anybody give me some help. Thanks.
should work in build too. make absolutely sure you never access any of those materials with the material property because only one call creates a new instance of it and it will be unaffected.
It's working now for some reason even so when strangely in another scene it wasn't working properly. Thanks for the tip I wasn't aware it made a new instance for each material object.
Your answer
Follow this Question
Related Questions
Material doesn't have a color property '_Color' 4 Answers
Changing two different objects renderer colour 1 Answer
Change Color in C# with RGB Values? 4 Answers
Changing Game Objects Color 1 Answer