Author Topic: First Child of a Scroll View/Grid not responding to events  (Read 2479 times)

robc

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
Hi all,

I'm currently running into an odd issue with a scroll view/grid combination. I'm currently using NGUI 3.5.8 (standard, via the Asset Store) on Unity Pro 4.3.4.

I have my scene set up so there's a scroll view, with a child grid (primarily to ease with the layout - as the children are static once positioned). Each of the children is a Panel (which has a Button & Collider attached) which parents some labels & sprites, as below:

UIRoot
|- Scroll View Panel
   |- Grid
      |- Child 1
         |- Sprites
         |- Labels
      |- ...
      |- Child 10
         |- Sprites
         |- Labels


Where I'm stuck, is that the button on the first (and only the first) panel doesn't respond to any input events (although I can still drag on it to scroll - even if the UIDragScrollView component is disabled), yet the rest of my panels do. I've checked to make sure the collider & the button components are active. I've also played around with toggling these whilst the game's running - but there's no effect.

I'm wondering if perhaps I've missed a step somewhere along the lines in setting this up, as it's the first time I've tried to use a scroll view in a project, or if anyone else has run into this behaviour previously (though, I did a quick search of the forum to see if anyone has, and didn't seem to find it).

If there's any other info you need, please do let me know - and I'll see what I can provide to help sort it out.

Many thanks,
- Rob

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: First Child of a Scroll View/Grid not responding to events
« Reply #1 on: May 05, 2014, 11:07:11 PM »
Why is each of the children a panel?

Remove that panel. There should only be one panel -- on the scroll view.

Also when in doubt, enable "debug" option on the UICamera. NGUI will show you what the mouse is hovering over (and thus what will intercept events).

robc

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: First Child of a Scroll View/Grid not responding to events
« Reply #2 on: May 06, 2014, 01:27:59 AM »
Why is each of the children a panel?

Remove that panel. There should only be one panel -- on the scroll view.

Also when in doubt, enable "debug" option on the UICamera. NGUI will show you what the mouse is hovering over (and thus what will intercept events).

Awesome. Managed to get it sorted out now!

I originally used the panels because I thought they were necessary for handling renderable child objects (each of my items is made up of a combination of 5 labels/sprites/textures). I've replaced those with plain GameObjects as the parents (with all my other components and GUI components as children).

The next thing I ran into was having the collider on the scroll view interfering with the colliders. So I removed that as well, and it's all working.

Many thanks for the pointers :)