Author Topic: Changing UITexture.mainTexture causes flickering  (Read 3390 times)

advanches

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Changing UITexture.mainTexture causes flickering
« on: May 01, 2014, 06:11:28 AM »
Hi all. :D

I need to swap some textures on a UITexture as the user drags their finger on the screen.
But using UITexture.maintexture causes the widget to flicker.
Tried using a GUITexture instead and it has no problems.

I appreciate your help.
Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Changing UITexture.mainTexture causes flickering
« Reply #1 on: May 02, 2014, 07:42:57 AM »
In what version of NGUI and what do you mean by flickering?

Call Refresh() on the widget's panel.

advanches

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Changing UITexture.mainTexture causes flickering
« Reply #2 on: May 02, 2014, 02:58:27 PM »
Hi, Aren.

I'm using version 3.5.8.
What happens is that you can see the UITexture flashing as it disappears and reappears very quickly when it changes the texture.

Unfortunately calling Refresh() on the panel didn't solve the issue.

Thanks for your help.

advanches

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Changing UITexture.mainTexture causes flickering
« Reply #3 on: May 02, 2014, 06:49:03 PM »
I managed to fixed my problem by changing the UITexture.mainTexture inside the Update function instead of the drag event handler.

Cheers.


MGB

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Changing UITexture.mainTexture causes flickering
« Reply #4 on: June 10, 2014, 06:51:38 AM »
I'm seeing bad flickering when updating UITexture too.  Strangely, setting focus to an input control makes the flickering a lot worse.
Had to write my own code to update the drawcall.dynamicMaterial.mainTexture - maybe this is the cause?

Is there a proper way to update the texture dynamically yet?
[NGUI v3.5.5]

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Changing UITexture.mainTexture causes flickering
« Reply #5 on: June 11, 2014, 05:05:11 AM »
Why are you changing the draw call's texture yourself? You should never be doing that. Also -- your NGUI is quite a bit out of date. Please update.

MGB

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Changing UITexture.mainTexture causes flickering
« Reply #6 on: June 14, 2014, 05:46:37 AM »
Updating it myself because changing it's texture at runtime didn't do anything (and I saw your comments on this post: http://www.tasharen.com/forum/index.php?topic=8126.msg38467#msg38467)
Will try update if possible...
« Last Edit: June 14, 2014, 05:56:28 AM by MGB »