Author Topic: Clipping doesn't work for a few frames after moving  (Read 3088 times)

Ninglis

  • Guest
Clipping doesn't work for a few frames after moving
« on: January 09, 2013, 02:28:56 PM »
Hi, I have looked around for a solution but haven't found any. I might just be searching the wrong words.

I have a UIPanel that contains a bunch of dynamically added prefab buttons laid out horizontally, and the panel clips to only show 9 at a time. There are buttons on either side of the panel to make it show the buttons to the left or right of the current shown buttons. When pressed, all the changes is that panel.transform.localposition -= changeAmount and panel.clipRange.x += change amount. This all works well, except for a few frames after either of the arrows is pressed, after the buttons have moved, every single button in the frame shows up, as if there is no clipping applied to the panel. The extra buttons not in the clipping range disappear probably after 10-15 frames.

Is there any way to force the clipping to be recalculated sooner? It isn't just the buttons that have moved out of the clipped area, it is all of them that show up. Is there a way to keep the clipping on?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile

Ninglis

  • Guest
Re: Clipping doesn't work for a few frames after moving
« Reply #2 on: January 09, 2013, 05:02:15 PM »
Thank you for replying back to me. It seems that the issue was that the UITextures on the buttons didn't have "Unlit/ Transparent Colored" shader on it, and it was just the textures flashing on screen while moving.

Ninglis

  • Guest
Re: Clipping doesn't work for a few frames after moving
« Reply #3 on: January 09, 2013, 06:03:56 PM »
Now that I have changed the shader to unlit/transparent color, changing the texture of UITexture doesn't change the image shown until the button is moved out of the panel's clip area and back into it. The only other way I can find to force it to refresh the image is by setting UITexture.enabled to false then immediately to true again. The problem if this produces a flicker when forced to update this way.

Do you know what change in the shader would could changing the texture not to redraw immediately, and what can be done to fix it?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Clipping doesn't work for a few frames after moving
« Reply #4 on: January 10, 2013, 01:49:13 PM »
Are you using the latest version of NGUI? How are you changing the texture?