esses
Topic Author
Posts: 9
Joined: 26 Sep 2016, 16:13

NoesisGUI blocking clicks?

26 Sep 2016, 16:20

Hello,

I have an issue with receiving mouse clicks in Unity's game world. However, for some reason OnMouseEnter() and OnMouseExit() work normally. Whenever I disable NoesisGUIPanel the clicks work again. What could be the problem?
 
User avatar
sfernandez
Site Admin
Posts: 3154
Joined: 22 Dec 2011, 19:20

Re: NoesisGUI blocking clicks?

26 Sep 2016, 23:29

Hi,

NoesisGUI consumes Unity's events when mouse hits any element of the tree. We do so by calling event.Use() on MouseDown and MouseUp event types, inside the OnGUI message.

What behavior messages are you using that are not working?
 
esses
Topic Author
Posts: 9
Joined: 26 Sep 2016, 16:13

Re: NoesisGUI blocking clicks?

27 Sep 2016, 09:38

Hi,

we're using primarily if (Input.GetKeyUp(KeyCode.Mouse0)) clicks while in OnMouseOver(). What baffles me is that we get to OnMouseOver() but the mouse input is not handled at all. For testing I tried also OnMouseDown() which also doesn't work if NoesisGUIPanel is active. Both click methods start working right away if I just disable the NoesisGUIPanel component from the UI Camera.

Edit: if I disable "Enable Mouse" from NoesisGUIPanel, the clicks to gameobjects work. However NoesisGUI buttons etc. don't work obviously anymore.
 
User avatar
sfernandez
Site Admin
Posts: 3154
Joined: 22 Dec 2011, 19:20

Re: NoesisGUI blocking clicks?

27 Sep 2016, 12:41

After experimenting a bit what I noticed is the following:
  • OnMouseOver is always received, even if mouse is over Noesis elements.
  • OnMouseEnter/OnMouseExit is always received, even if mouse is over Noesis elements.
  • OnMouseDown/OnMouseUp are only received if mouse is not clicked over Noesis elements. I guess this should be expected. What is strange is that when mouse is clicked over Noesis elements, an OnMouseExit followed by OnMouseEnter occurs, and I don't understand why Unity does that.
  • Input.KeyUp(KeyCode.Mouse0) is only true if mouse is not clicked over Noesis elements.
If you need that some clicks are not captured by specific Noesis elements, you should mark these elements not visible for hit testing. Remember that all UI elements that have a background (even a "Transparent" brush) are taken into account for hit testing. You can disable it by setting the property IsHitTestVisible="False" in an element:
<Grid Background="#80000000" IsHitTestVisible="False">
  ...
</Grid> 
 
Etana
Posts: 17
Joined: 21 Aug 2016, 13:14

Re: NoesisGUI blocking clicks?

28 Sep 2016, 12:40

Hello,
Esses and me work on same project so I elaborate our xaml hierarchy a bit.
We have "MainEditor.xaml" which contains
Image

All of those tabitems are our own usercontrols which looks something like this

Image

Here you can see element "Viewport" which is present on all of our individual editors.
Viewport is just
<Grid x:Name="Viewport" Background="Transparent" />
This viewport is just what Unity is rendering. In our case, just making viewport's prop IsHitTestVisible to false will not fix our issue because there is always some element which catches viewport click.

I'm wondering if we are doing something wrong because if you use Noesis in Unity there is always some "root" element present which is obviously always catching Unity's mouse click events so obviously there is something wrong with our project...?

Here is image of the actual ability editor where you can see how the viewport looks

Update:
After investigating a bit this it looks like TabControl from MainEditor is somehow capturing click event.
I'm quite sure this is a bug, if your customer wants to use TabControl in Unity while still being able to click on unity objects, it's not possible at this moment

Repro: Open your primitives sample scene, open primitives.xaml
Group Grid named "layoutroot" to TabControl and make TabControls background transparent and make "layoutroot" as TabItem of this TabControl. Obviously you can't anymore click on primitive objects because this TabControl is consuming clicks.
 
User avatar
sfernandez
Site Admin
Posts: 3154
Joined: 22 Dec 2011, 19:20

Re: NoesisGUI blocking clicks?

06 Oct 2016, 14:29

Following the Primitives sample I was able to reproduce your problem and I found a bug in our hit testing algorithm when using a certain type of geometries.

While we fix this bug, if you are using NoesisStyle.xaml you can modify the TabControl template as follows:

- In line 3133, add to the Border "BaseBorder" the property IsHitTestVisible="False".
- In line 3139, add to the Border "DisabledBorder" the property IsHitTestVisible="False".

Then, if you set the TabControl.Background="{x:Null}" it won't catch mouse clicks.

Let me know if you need help with the workaround.
 
[email protected]
Posts: 19
Joined: 16 Jan 2019, 23:16

Re: NoesisGUI blocking clicks?

12 Aug 2021, 18:36

Thanks, the {x:Null} background fixed the problem for me :)

Who is online

Users browsing this forum: No registered users and 1 guest