Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: peaj on August 26, 2014, 03:48:24 AM

Title: Custom shader parameters reset every frame
Post by: peaj on August 26, 2014, 03:48:24 AM
Hi,

I try to set 2 colors in my custom shader on a UITexture via script. The shader is nearly identical to the "Unlit - Transparent Color" shader except there are 2 additional
color properties and small changes in the fragment shader to make use of those.
In another thread I read it is recommended to change custom shader parameters via "widget.drawCall.dynamicMaterial".
I tried this but now I got the problem that the set parameters are reset every frame.
Even if I set the colors in Update it seems like every second frame is rendered without colors set.
So how can I persistently set custom shader parameters via script?

Best regards,
Pascal
Title: Re: Custom shader parameters reset every frame
Post by: ArenMook on August 26, 2014, 03:50:49 AM
http://www.tasharen.com/forum/index.php?topic=10960.0
Title: Re: Custom shader parameters reset every frame
Post by: peaj on August 26, 2014, 04:13:00 AM
Thx for your fast reply, but I could not find onRender anywhere.
Autocomplete does not show it and even in the documentation of UIWidget
I could not find it. Neither in UIWidget nor in UITexture.
Maybe sth. changed?
Title: Re: Custom shader parameters reset every frame
Post by: ArenMook on August 27, 2014, 03:45:38 AM
Sounds like your version of NGUI is not up to date.
Title: Re: Custom shader parameters reset every frame
Post by: peaj on August 27, 2014, 06:38:25 AM
Yeah thx I just read it in the other thread, too.
I was a little bit confused because the NGUI documentation wasnt up to date either.
I'll try it out as soon as we are able to update NGUI.