So another thing that have been broken in my project after migration to 4.9.
Im displaying stats window OnBeginCursorOver on Actor. Everything is ok if I add this stats window to viewports.
But after that if I hide this widget and then SetVisiblity to true the events gets crazy.
There is an inifnitive loop (if im pointing Actor) with OnBeginCursorOver, OnEndCursorOver, OnBeginCursorOver etc…
This thing works in UE 4.8
So once more time my setup:
OnBeginCursorOver:
If widget not in viewport - add to vieport
If widget in viewport - set visibility to show
OnEndCursorOver:
set visibility to hidden
Edit1:
Is is normal that UUserWidget triggers event OnMouseEnter on SetVisibility to visible?
When OnMouseEnter is triggered it is rather normal that it steals OnBeginCursorOver
And so, when I Add widget to viewport everything is good, but after that when I Set Visiblity to Visible the widget steals the event.
So the real problem is that UUserWidget is getting event On Mouse Enter when its Visibility is each time set to Visible, even if there is nothing to display by this vidget.
Are you setting the canvas panel to visible as well? Would it be possible for you to provide a simplified version of your project so that I can take a closer look?
I’m setting visibility on whole UUserWidget object, so I suppose that canas panel is also set to visible, am I wrong?
Instead of simplified viersion of project I will simplifie the question:
Is is normal that UUserWidget triggers event OnMouseEnter on SetVisibility to visible?
When OnMouseEnter is triggered it is rather normal that it steals OnBeginCursorOver
In the case that you have stated this would be the correct functionality. The OnMouseEnter should be triggered when setting the entire widget to visible. This means that all widgets that have been added to the viewport (including the canvas) are now able to interact with the mouse. OnMouseEnter fires off when the mouse is over a widget that excepts mouse input. This means that when all widgets are changed to visible and they take up the entire screen that the mouse has just entered a valid widget. I hope that this information helps.
You could use a Boolean in your OnMouseEnter override. This will give you the control that you need. You may also have to set the visibility of the individual widgets so that only the widgets that you would like to have affected by the OnMouseEnter effect are affected. I hope that this helps.