I’m trying to implement a UI using 3d widgets. Everything works perfectly in singleplayer, but when I switch to running as a listen server it all falls apart. On singleplayer, hovering changes the color of the widget, and click events are registered and communicated as expected.
When running as a listen server with 1 connected client, hovering the widget causes it to flicker between “hovered” and “unhovered”. On the server process when I mouse over the widget, the prints go something like this:
“server: hover detected”
“server: unhover detected”
On the client process the prints go something like this when I mouse over the widget:
“client 1: hover detected”
“client 0: unhover detected”
Why are there 2 client connections listed when there should only be 1 client?
Why does even the server rapidly hover/unhover the widget?
Why is this problem unique to multiplayer?
Any help or relevant insight would be appreciated.
The solution that worked for me was setting a unique Virtual User Index on the owning client. Each player must have a unique Virtual User Index, which can be safely derived from the PlayerState PlayerId, and this setup must run on the client, not the server. Also, deactivate the Widget Interaction component by default and activate it at runtime after assigning the Virtual User Index. Once this was done, hover and click started working reliably for all players, and button states could be handled purely through styles set in the Widget Designer.