antsonthetree
Topic Author
Posts: 44
Joined: 09 Jan 2018, 15:56

Unity Noesis elements do not block mouse clicks.

29 Mar 2018, 15:49

Hello,

I am using Input.GetKeyUp(KeyCode.Mouse0) and Input.GetMouseButtonDown(KeyCode.Mouse0) to detect clicks on a surface in a click-to-move game. However when clicking on any Noesis elements on my HUD, the clicks are still detected by Unity's functions.

This behavior is contrary to the information given in this thread.

Is this a bug? What is the best way to prevent clicks on my UI from getting passed to Unity?

Thanks
Jake
 
User avatar
sfernandez
Site Admin
Posts: 1628
Joined: 22 Dec 2011, 19:20

Re: Unity Noesis elements do not block mouse clicks.

02 Apr 2018, 13:24

In previous versions of Unity calling Event.Use() consumed the event preventing other components to use Input.GetMouseButtonDown/KeyUp.
But that doesn't seem to be true anymore, so we may need another approach for this.
Could you please add a ticket in our bugtracket to study and discuss how to properly solve this?

Meanwhile you can probably use VisualTreeHelper.HitTest to detect if mouse is over any Noesis UI element.

Who is online

Users browsing this forum: No registered users and 3 guests