- antsonthetree
- Posts: 44
- Joined:
Unity Noesis elements do not block mouse clicks.
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
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
-
sfernandez
Site Admin
- Posts: 3008
- Joined:
Re: Unity Noesis elements do not block mouse clicks.
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.
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: Bing [Bot], Google [Bot] and 5 guests