Author Topic: UIPanel Clipping problem  (Read 13333 times)

Jason

  • Guest
UIPanel Clipping problem
« 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel Clipping problem
« Reply #1 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).

Jason

  • Guest
Re: UIPanel Clipping problem
« Reply #2 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel Clipping problem
« Reply #3 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.

Jason

  • Guest
Re: UIPanel Clipping problem
« Reply #4 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.


Jason

  • Guest
Re: UIPanel Clipping problem
« Reply #5 on: May 04, 2012, 11:00:38 PM »
picture 2

Jason

  • Guest
Re: UIPanel Clipping problem
« Reply #6 on: May 04, 2012, 11:01:11 PM »
picture 3

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel Clipping problem
« Reply #7 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?

Jason

  • Guest
Re: UIPanel Clipping problem
« Reply #8 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.


Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UIPanel Clipping problem
« Reply #9 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. :)

Jason

  • Guest
Re: UIPanel Clipping problem
« Reply #10 on: May 05, 2012, 09:35:55 AM »
ok, here are the settings for the buttons.

Jason

  • Guest
Re: UIPanel Clipping problem
« Reply #11 on: May 05, 2012, 09:36:32 AM »
And here are the settings for the background sprite.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel Clipping problem
« Reply #12 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.

Jason

  • Guest
Re: UIPanel Clipping problem
« Reply #13 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel Clipping problem
« Reply #14 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.