Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Jason on May 04, 2012, 05:01:21 PM

Title: UIPanel Clipping problem
Post by: Jason on May 04, 2012, 05:01:21 PM
hi,

I am trying to set up a scrolling panel using the Clipping method.

To try it out, I attached a UIPanel to UIRoot. I then created two standard sized buttons. One is placed at the center of the screen and the other 200 pixels above it. Finally, I applied clipping in the UIPanel inspector.

I was able to show only the centered button by clipping, but only with Center (0, 0) and Size (2,2). If the Size deviation from 2, e.g. 2.01, it distorts and ruins the button. I tried to find the other button by adjusting Center.Y I haven't been able to find it.

Please let me know if I am missing anything. Thank!

Jason
Title: Re: UIPanel Clipping problem
Post by: ArenMook on May 04, 2012, 06:25:06 PM
Eh? If the other button was clipped, you won't see it visible until it comes into view. Furthermore, the size should remain at (1, 1, 1).
Title: Re: UIPanel Clipping problem
Post by: Jason on May 04, 2012, 08:58:16 PM
Well, i was talking about the parameters for Clipping. I thought it would be the center and width and height of the visible box in pixels. So, it looks like a 2 pixel by 2 pixel box enabled me to show my center button. Anything else fails to do that.
Title: Re: UIPanel Clipping problem
Post by: ArenMook on May 04, 2012, 09:16:26 PM
You might need to elaborate with pictures for me to understand what you mean. Panel's clipping rectangle is shown as a pink box.
Title: Re: UIPanel Clipping problem
Post by: Jason on May 04, 2012, 11:00:01 PM
ok. I attached three pictures.

Picture one shows that I have a brand new UI with two buttons, one centered and the other moved up by 200 pixels. I have a clipping area centered at (0, 0) and sized (200, 100). The pink box encloses the center button.

Picture two is a screenshot during gameplay at the above settings. The center button is a blur.

Picture three shows what happens when I change the clipping area size to (2,2). The center button is displayed normally.

I am using a Macbook Pro running Unity 3.4.2 and the latest NGUI release.

Title: Re: UIPanel Clipping problem
Post by: Jason on May 04, 2012, 11:00:38 PM
picture 2
Title: Re: UIPanel Clipping problem
Post by: Jason on May 04, 2012, 11:01:11 PM
picture 3
Title: Re: UIPanel Clipping problem
Post by: ArenMook on May 04, 2012, 11:17:39 PM
Actually you're not using the latest version of NGUI. Youre panel is missing some settings. Something is also wrong with your button to begin with... even in the first screenshot it looks garbled. Is the atlas using the Unlit/Transparent Colored shader?
Title: Re: UIPanel Clipping problem
Post by: Jason on May 05, 2012, 12:26:50 AM
You are right. I should have updated more often, knowing how active NGUI is being developed :)

Now I have the Static option for my panel, but I still have the same problem as before.

I created the buttons using the SciFi Atlas and Fonts.

Title: Re: UIPanel Clipping problem
Post by: Nicki on May 05, 2012, 08:29:15 AM
Take a picture of the button settings and throw in here, makes it a lot easier to debug. :)
Title: Re: UIPanel Clipping problem
Post by: Jason on May 05, 2012, 09:35:55 AM
ok, here are the settings for the buttons.
Title: Re: UIPanel Clipping problem
Post by: Jason on May 05, 2012, 09:36:32 AM
And here are the settings for the background sprite.
Title: Re: UIPanel Clipping problem
Post by: ArenMook on May 05, 2012, 11:14:59 AM
Everything looks fine to me, except one thing...

Your readme states it's version 1.83, which is quite old. Please update to the latest.
Title: Re: UIPanel Clipping problem
Post by: Jason on May 05, 2012, 11:33:15 AM
I was afraid to remove the NGUI/ folder entirely for fear of breaking everything. I always overwrite my files when I updated. The Readme file is funny. Its name stays the same but its content gets changed.

Any way, I just deleted NGUI/ and reinstalled it. I created a new scene, new panel, two buttons, move one up, and apply clipping. Somehow I have to set the clipping size to (2, 2).

Sorry for being a pain in the butt, but here is another screenshot. This time in edit mode. The clipping box is so small you can't even see it.
Title: Re: UIPanel Clipping problem
Post by: ArenMook on May 05, 2012, 11:33:25 AM
Well, the size of your clipping box is smaller than the size of the soft border, so it's not working right to begin with. The size of your clipping area must be at least double the size of your border, so if you  use a 40x40 border (which is quite thick by the way), you need to have at least a 80x80 area. I generally leave the border at 10 pixels.
Title: Re: UIPanel Clipping problem
Post by: Jason on May 05, 2012, 11:34:19 AM
And if I set the clipping size to (200, 100), the box looks right, but the button is a blur.
Title: Re: UIPanel Clipping problem
Post by: ArenMook on May 05, 2012, 11:34:22 AM
Although you've mentioned that your clipping area was 200x100, which should be fine.
Title: Re: UIPanel Clipping problem
Post by: ArenMook on May 05, 2012, 11:35:11 AM
The button isn't a blur in that screenshot. Its geometry seems just wrong.
Title: Re: UIPanel Clipping problem
Post by: ArenMook on May 05, 2012, 11:36:00 AM
Occam's Razor...

Your target is Android. Are you sure you don't have GLES 1.1 emulation enabled?

GLES 1.1 = no shader support, clipping doesn't work.

(it's in the FAQ btw...)
Title: Re: UIPanel Clipping problem
Post by: Jason on May 05, 2012, 11:50:07 AM
My bad! I knew you would figure it out ...  ;D