Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: hungweng on May 30, 2013, 01:34:46 AM
-
Hi,
I have some properties on the material used by the Sprite that I would like to change by code, but I am not sure where to get the material used by the sprite.
The sprite.material returns the sharedMaterial but that would change all the sprite used by the same material which is not what I want.
How should i implement this?
-
You can't modify materials per-sprite. There is only one material -- on the atlas. That's how everything is able to get batched into one draw call.
-
Thanks ArenMook
What I have is a HSV shader that can do the Hue shifting, and the UISprite is actually a spriteAnimation using an atlas on its own.
Instead of having the artist to produce different textures for different color variation of the sprites, I thought I can save the product size by using the shader
So I guess if I really need to use different materials I'll have to duplicate both the UIAtlas prefab and the material in the editor and create sprites using the duplicated atlas...
I know it's going to have an extra drawcall but currently the drawcall is still very low so I guess it won't affect the performance for our game...at least not much
-
I have an alternative solution, and now is optimizing. :)
-
Hello Galuodo,
Is it possible to share the alternative solution of yours or perhaps some hints please? Thanks!
-
use UITexture