Author Topic: How to block OnMouseOver with UIPanel  (Read 2554 times)

zippo227

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 55
    • View Profile
How to block OnMouseOver with UIPanel
« on: February 20, 2014, 02:04:04 AM »
Hi I have some clickable objects in my game that are not using NGUI at all. When I have an NGUI panel with a 2d box collider that covers that object, the OnMouseOver events on that object are still called. Is there a way to block that event, or do I need to have a reference to the GUI camera and poll it somehow to see if I should not respond to this event. Thank you!

indrkl

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: How to block OnMouseOver with UIPanel
« Reply #1 on: February 20, 2014, 05:44:53 AM »
I would also be really interested in knowing how to do that. The reason is I'm using polygon colliders in the game world (Hexagon map for a turn based strategy game), and I don't want the clicks on the map to do anything while I am mouse overing any part of my UI.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to block OnMouseOver with UIPanel
« Reply #2 on: February 20, 2014, 09:26:54 AM »
OnMouseOver is a Unity event, not an NGUI event. You can't block it.

OnHover(bool isOver) is the NGUI equivalent.

Also you can't block anything with a UIPanel because UIPanel is just what draws widgets. You can only block things with other widgets. ALT+SHIFT+W creates an invisible widget. ALT+SHIFT+C gives it a collider. This widget will now block hover events.