Author Topic: Hello. I found a problem about UITexture.  (Read 1927 times)

nugao

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Hello. I found a problem about UITexture.
« 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Hello. I found a problem about UITexture.
« Reply #1 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.

nugao

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Hello. I found a problem about UITexture.
« Reply #2 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.
« Last Edit: April 27, 2015, 11:12:59 PM by nugao »