OnBeginCursorOver with widget problem in ue 4.9

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

Hello JaroMast,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide a detailed set of step to reproduce this issue on our end?
  3. Could you provide screen shots of any blueprints that may be involved with this issue?
  1. Kind of, I have attached screens of blueprints and c++ code.

Under main character I create UUserWidget

Actor that reacts on mouse cursor

58314-3.jpg

Simple code for showing and hiding widget

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.

Hello JaroMast,

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

Hello JaroMast,

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.

Make it a great day

Thanks for your answer.

Is it possible to show hidden widget without triggering OnMouseEnter for canvas panel or whole widget?

Hello JaroMast,

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.

Actually I found other solution to this problem:
Instead of setting widget to Visible I set it to HitTestInvisible.

Thanks for your support :wink: