Using AddDynamic on a UButton's OnHovered event not working

I have these three lines of code:


UIElement_InvButton->OnClicked.AddDynamic(UIElement_InvButton, &UHQButton_ItemButton::Clicked);

UIElement_InvButton->OnHovered.AddDynamic(UIElement_InvButton, &UHQButton_ItemButton::Hovered);

UIElement_InvButton->OnUnhovered.AddDynamic(UIElement_InvButton, &UHQButton_ItemButton::Unhovered);


When I click the button, it runs Clicked() as expected.

When I hover the button, the Hovered() function is not even called.

Anyone have a thought as to why this might be happening?

Ok, not really a solution, but a workaround that might help someone explain what happened. Everything started working as soon as I added this line:

UE_LOG(LogClass, Log, TEXT(“Output”));

Anyone know why this would suddenly make the function start working?

I just got the same problem and I solved it by moving “OnHovered.AddDynamic” and “OnUnhovered.AddDynamic” to another function that will be called later than the constructor.
And it is necessary to check if onhovered and onunhovered is already bound.