- Home /
Changing material of an object VS Changing the color property of the material which is more efficient ?
So, using a script which holds an array of 5-6 materials and then using this script to change the material of a particular object
or
using a script to just hold 5-6 color values then changing the objects>materials> color value
which is more efficient ? [Making a casual game for mobile devices - so it should run on a device that's even 2/3 years old]
Answer by Namey5 · Jul 22, 2020 at 10:02 AM
This is actually a pretty interesting question. Initially I would have said that you want as few materials as possible (and that still is the case), however in your case accessing renderer.material to change the colour per-renderer actually creates a new material behind the scenes - so if this was going to be used on multiple objects then having a list of pre-created materials and setting those to the renderer's sharedMaterial would probably be more efficient.
Your answer
Follow this Question
Related Questions
Change Material VS Change Texture Performance 0 Answers
Lesser Materials : how much better performance ? 1 Answer
When camera is close to texture fps drops off drastically 1 Answer
Optimizing Performance with tris 0 Answers
Is having many instances of the same material bad for performances? 3 Answers