Author Topic: Prevent clicking/dragging through  (Read 1525 times)

Jordy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Prevent clicking/dragging through
« on: December 30, 2016, 02:15:53 PM »
Hi, I just started learning NGUI. I have a top down strategy game where players can drag the landscape view. On top I have a 2D UI. The main navigation has some buttons, and when I click them a modal is opened. But players can still click and drag through the modal. How can I prevent that? How can I set the sprite so that it prevents clicking and dragging through? I tried some other things I read on this forum, like setting a box collider on the sprite, but it's not working. Could someone help me out?

Something about my setup (I don't know exactly what is relevant to know for this issue):

* UI Root (parent and children have 'UI' layer)
** Camera (Culling Mask: UI, Depth: 1)
** Panel
*** MainUI Widget
**** Nav button ranking
**** Nav button settings
**** Nav button quests
*** SettingsUI Widget
**** Background sprite
***** BG Stripes


devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: Prevent clicking/dragging through
« Reply #1 on: December 30, 2016, 06:48:50 PM »
couple things to try:

1.  UICamera.ignoreAllEvents
2.  create a new panel+widget, add a box collider that stretches the entire UI - make sure to set the correct depth