Author Topic: UIPanel dragging/clipping problem  (Read 2053 times)

mplaczek

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 14
    • View Profile
UIPanel dragging/clipping problem
« on: March 03, 2014, 09:05:22 AM »
Hi,

I have built a 'parchment scroll' window that when presented, unfurls to present information that will take the form of a few UILabels and UISprites. This effect is beautifully handled by using the panels clipping.
However, I am also required to have this window scaleable (handled beautifully with your anchors) and draggable.

When dragging however, the sprites and labels jitter quite a bit... The only difference between this panel and other working draggable panels I have made is the clipping mask. And it seems I am able to circumvent this problem by turning off the UIPanels clipping after the 'scroll' has 'unfurled'. The dragging is nice and smooth.
(Although I do hate fixing problems by tweaking till it works, and not understanding why!)

By adjusting the clipping I have now stumbled across another problem... when the window is closed, I reset the clipping back to alpha for the next time the window is opened, the sprites appear as solid colour blocks and are not clipped, and the labels all but vanish. When the window is reopened the sprites and labels remain in this state until the animation is completed when they appear as they should again. Perhaps this is a Unity shader problem? Is there a better way to restore the panel to it's initial 'perfectly working on first open' state?

Any thoughts on either of these problems would be greatly appreciated.

Here are a few screenshots... apologies for the placeholder sprites etc...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel dragging/clipping problem
« Reply #1 on: March 03, 2014, 11:05:56 PM »
Blank colored rectangles mean your shaders are not working. This happens if you are targeting a device that doesn't have shader support (ARMv6 / GLES 1.1), your Quality settings are set to "Fastest", or you moved the NGUI's shaders from their place in the Resources folder.

mplaczek

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: UIPanel dragging/clipping problem
« Reply #2 on: March 04, 2014, 04:50:56 PM »
Hi ArenMook,
Thanks for the quick reply.
This project is being built for Windows 7... I don't usually use windows 7 but I assume the shader support should not be a problem on a desktop machine? I have ensured the build is run at the highest quality setting, and I know not to move your shaders around ;-)
I still see the sprite and labels momentarily go blank during the scaling animation after toggling the clipping. I'll have another look in the morning... I'll try to replicate in a simpler scene to get more information... However, if anyone has any other thoughts, they would be greatly appreciated.


mplaczek

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: UIPanel dragging/clipping problem
« Reply #3 on: March 06, 2014, 04:10:37 PM »
Ok... I figured out what I did wrong... I was setting the clipping enum to 1 and not 2.  ::)
Note to self... read the documentation properly twice... code once!

enum Clipping : int { Clipping.None = 0, Clipping.AlphaClip = 2, Clipping.SoftClip = 3, Clipping.ConstrainButDontClip = 4 }