Author Topic: Unable to use UIButton inside an UIScroll View  (Read 3589 times)

Blyzard

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 3
    • View Profile
Unable to use UIButton inside an UIScroll View
« on: October 03, 2014, 11:48:10 AM »
Hello !

I'm using Unity and NGUI since one year and never had a problem with NGUI before thanks to this forum, but i'm stuck for this functionnality: Using an UIButton inside a UIScroll View.

Of course, i have searched on the forum and found advices, like here and here .

However, and following your advices, i'm unable to have it working, i'm very sorry.

Here is my configuration:

- UIWidget/Box Collider/UIDrag Scroll View
- UIPanel/UIScroll View/RigidBody
-- UISprite/UIButtons/BoxCollider (Button 1)
-- UISprite/UIButtons/BoxCollider (Button 2)
-- UISprite/UIButtons/BoxCollider (Button 3)
-- UISprite/UIButtons/BoxCollider (Button 4)
etc...

My UIButtons having a depth of 47, and my UIWidget having a depth of 43.
My UIWidget is covering the scrolling area, and the box collider attached to it too.

However, i can't scroll, UIButtons take the event only.

There is no Plain GameObject, and only GameObjects on NGUI Layer.
The Child buttons has been had with NGUITools.AddChild.

Is there something wrong in my configuration ?

Thank you in advance for your help !

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Unable to use UIButton inside an UIScroll View
« Reply #1 on: October 04, 2014, 08:00:28 AM »
Your button and widget depths don't matter in this case, because they belong to different panels. Panel depth is more important than widget depth.

You need UIDragScrollView on your buttons as well. NGUI's events don't fall through to objects below them. The top-most object intercepts all of them.

Blyzard

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Unable to use UIButton inside an UIScroll View
« Reply #2 on: October 04, 2014, 04:58:27 PM »
I didn't though about this, now i will know how work Scroll View with Drag Scroll View :) !
I tested, everything is working know !

Thanks a lot !