Author Topic: Cannot block events to dynamically created Scroll View elements  (Read 1970 times)

fisheye

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
I have an options menu which covers the screen with a collider to intercept events.  This works fine for all the elements behind it EXCEPT the scroll view children that I create at runtime.  I cannot seem to block the events to them, they are still draggable even though the empty space in the scroll view is blocked properly.  Changing Z of the prefab doesn't help, neither does changing the Z of the collider itself.

My current setup is:

Background Sprite (With box collider and Drag Scroll View)
-> Scroll View
->->Children created from prefab with box collider and Drag Scroll View)

What can I do to block events to these when my options window is open?

fisheye

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Cannot block events to dynamically created Scroll View elements
« Reply #1 on: June 27, 2016, 10:17:05 PM »
Another odd thing I didn't notice.  I just stretched my options screen to try to cover the scroll view instead, just to cheat.  But the child elements are always on top of it!  No matter what depth I give them, they still appear on top of it.  So it's not just the colliders, everything about these instantiations is always on the very top...

I'm simply using AddChild to instantiate them as children of the scroll view, and then giving them a localposition offset, nothing fancy.  Any thoughts why they always appear on top of everything?

fisheye

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Cannot block events to dynamically created Scroll View elements
« Reply #2 on: June 27, 2016, 10:40:28 PM »
Oh geez, I figured it out.  My scroll view panel was a higher depth than my "main" panel that everything else is on.  Swapping them made it work just fine.