Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: mtran003 on May 18, 2012, 01:17:05 PM
-
The is there an effective, performance optimized method of changing color tint and alpha setting of all the sprites that share the same atlas and texture at the same time?
I may have several hundred sprites that I would need to affect and looping over a sprite array does not seem effective--especially during frame Update where the value changes over time.
With regular Unity, I'm able to get a reference to the Material and the set the material's ".color.a" value at runtime.
Is there something similar for NGUI?
-
You can use a different material/shader that uses a color component, but the same texture. This will then allow you to change the tint color of all of the elements that use that material at runtime by just changing that one material's color component. Having another material will cause your draw calls to increase if you have UIPanels that use multiple materials.
-
Or you can just modify the shader, adding a color property.