Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: nugao on April 27, 2015, 03:23:21 AM

Title: Hello. I found a problem about UITexture.
Post by: nugao on April 27, 2015, 03:23:21 AM
Hello.

I found a problem about UITexture.

I use a UITexture with Material, the Material use a Procedural texture.

In editor is work, when I build it and run, the UITexture is not work.

To fix it, I need set Texture and Material both for UITexture.

Thanks.


I work in U3D 4.6.3f1, NGUI 3.8.0.
Title: Re: Hello. I found a problem about UITexture.
Post by: ArenMook on April 27, 2015, 04:40:12 PM
The way NGUI works is it creates a copy of the material for run-time. Modifying the original material won't affect NGUI's drawing. You need to adjust UIWidget.drawCall.dynamicMaterial instead of the original material at run-time, or simply set UIWidget's onRender callback. It will pass the material to that delegate and you can do what you want with it.
Title: Re: Hello. I found a problem about UITexture.
Post by: nugao on April 27, 2015, 11:01:42 PM
Hello.

As you said. I use dynamicMaterial instead of the original material, but it not work at all. Because I must SetBuffer for the original material. Maybe the Material's Buffer(ComputeBuffer in Shader) can not copy, so the copy of the original material is not work. I set a Debug.Log in onRender, i find it don't call in run-time.

I have set onRender callback. As I said, it work in Editor, not work in run-time. In my method to fix it, I set Texture and Material both for UITexture object.

Thanks.