Using 3D widget with widget interaction component creates constant hover and unhover events

Hi all,

I’m hoping this is the right place to ask about problems I’m having as I would normally use the answerhub but it appears to be down for maintenance…

I’m making a VR project and am running into an issue with 3D widgets. I’ve got a 3d widget component in my player character showing them a menu, and I also have a widget interaction component attached to the MotionController so that the user can interact with this menu. Interaction works mostly fine - I can click on buttons and do all the things I need to do - but when I hover over a button instead of just firing the hover event once, it fires a continuous stream of hover/unhover events meaning I can’t do stuff like playing hover sounds without spamming the user with sound. I have used 3D widgets before in this project for the home menu and hovering was working fine there - so maybe it could be something to do with having the interaction component and the widget component both being in the same blueprint?

Does anyone have any ideas what could be causing this?

Note - I did see a forum post with someone talking about this same issue, and a few people responding saying it was the same for them, but no answers or suggestions. So I know I’m not the only one!

Thanks for any help you can give!

This happened when i had multiple widget interactions and didnt set my pointer index to be different on all of them - select your widget interaction components and make sure each has a unique pointer index

2 Likes

Pointer indexes 0 and 1. Hover / unhover events fires constantly, after 2nd player joins the game.

You need to set a unique Virtual User Index for each player. I would also make sure that the WidgetInteractionComponent only exists on the owning client.

Virtual User Index does NOTHING in my case (but according tooltip it must).
When i set different Virtual User Indexes for P1 and P2 (checked via PrintString) i receive same infinite hover/unhover firing.
BUT
When i changed “Pointer Index”, it’s do the trick
изображение

So, as far as i understand Pointer indexes must be unique not within character (0 and 1), but for all “Widget Interaction Component”-s among all Players.
Solution is below.

But anyway, why i need Virtual User Index??? For what cases???

UE assumes all WidgetInteractionComponents are virtual and would never be assigned to a specific player controllers id.

The result is that when UWidgetInteractionComponent::Activate is first called the VirtualUser gets populated by an incremental synthetic value starting after SlateApplicationDefs::MaxHardwareUsers instead of using the VirtualUserIndex assigned via the UWidgetInteractionComponent.

Then to throw salt onto the wound, when UWidgetInteractionComponent::SimulatePointerMovement constructs the PointerEvent that gets routed into slate. UE uses ‘GetUserIndex’ which is really the aforementioned synthetic user index, and not the ‘virtualUserIndex’ you populated.

As far as I can tell, VirtualUserIndex is only used to try retrieve an existing virtual user if one already exists and literally nothing else.


Imagine how much trouble would be mitigated by just assigning the result of GetPlayerControllerID into the VirtualUserId field and using that value in FPointerEvent to identify who the interaction event belongs to.

Then the clashing pointer indices could be synthetic and incremented if not manually assigned.

Alas, this is UE, and as such nothing can be straightforward, especially in fing slate…

P.S. Word of caution about BP’s, they’re extremely limiting and super fragile, I highly recommend migrating anything more complex than 2-3 basic functions into C++ asap. Sure, you can always migrate when performance becomes an issue, but I’ve found that BP’s screw up far more frequently. Additionally, by the time you’re chasing broken systems, you’re generally going to have to port then entire dependency chain for your BP and any other BP’s they may need to use cast on which is akin to refactoring all that work at the 9th hour.