Author Topic: Scrollview + colliders inside  (Read 4321 times)

klept

  • Guest
Scrollview + colliders inside
« on: November 02, 2012, 12:36:58 AM »
Hello this is my first post  ;D I have a problem. I have a ScrollView (Clipped Panel version) with huge amount of colliders (buttons) these buttons can be clicked when they are clipped (they shouldn't) how should I approach this problem? sorry if this is repost/noob question. I searched in google and read the f.a.q's and didn't find anything.

Thanks in advance!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrollview + colliders inside
« Reply #1 on: November 02, 2012, 02:45:36 AM »
Same way it's handled in the scroll view example. Put a big collider covering the area where the items can be scrolled out of view.

Funder

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Scrollview + colliders inside
« Reply #2 on: November 08, 2012, 04:34:13 AM »
I have the same problem and placing colliders outside the list is not possible in the project I'm working on.
We have a dynamically build UI with several panels with buttons and lists. Placing colliders to block clipped colliders, will also block other ui interactions.

It might be solved if NGUI casted events like OnVisible/OnInvisible - then colliders could be turned on or off. But NGUI does not support that to my knowledge.

Do I really have to write my own scroll list view from scratch?

Any ideas would really be appreciated?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrollview + colliders inside
« Reply #3 on: November 08, 2012, 04:46:56 AM »
I suggest modifying the UICamera's Raycast function then. You will want to RaycastAll instead, and for each hit, GetComponent<UIWidget>(), see if its panel is clipped, and if it is -- check -- is the point within view? If yes, it's a valid event. If not, skip it and move on to the next hit.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrollview + colliders inside
« Reply #4 on: November 08, 2012, 04:47:28 AM »
Btw, you will see this already built-in with the next version of NGUI.

haleraner

  • Guest
Re: Scrollview + colliders inside
« Reply #5 on: November 13, 2012, 10:51:18 AM »
Btw, you will see this already built-in with the next version of NGUI.

Are there any information when the next version will be released? We are currently making some prototypes, to test if ngui could replace our existing ui system and this is a very critical point for us.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrollview + colliders inside
« Reply #6 on: November 13, 2012, 03:58:38 PM »
I already released version 2.2.4 and 2.2.5 to Pro users, so shouldn't be long now. 2.2.6's ETA is likely tomorrow.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Scrollview + colliders inside
« Reply #7 on: November 14, 2012, 02:45:32 AM »
Aw man, I wish I was a pro user.

Funder

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Scrollview + colliders inside
« Reply #8 on: November 20, 2012, 05:38:31 AM »
Cool ;-)