- Home /
Computing required to assign pre-existing material
I have a menu system that has a series of pushable buttons — only one can be selected at a time, so previous selections are de-selected.
I'm just wondering… if I use a for loop to go through each object and basically assign the default 'non-pushed' material to each button, only changing it to the 'pushed' material for that selected button, would it be a waste of resources to be re-assigning the material to all the other buttons even if they already have that material applied? Or would the CPU ignore it?
You can just reassign the texture rather than reassign the whole material.
renderer.material.texture = texNew;
I doubt there are performance issues with either way of changing the look.
Hadn't considered just changing the texture, thanks for the tip. (Although I believe it's material.mainTexture, rather than just material.texture).
It seems to be working alright, hopefully there's no noticeable slowdown.
Your answer
Follow this Question
Related Questions
single texture atlas or multiple textures? 0 Answers
single texture atlas or multiple textures? 0 Answers
Change Material VS Change Texture Performance 0 Answers
Loading textures from file 1 Answer
Texture and material not showing up 2 Answers