As shown above, I use the “Is Dedicated Server” (AND the IsLocalPlayer, but it doesn’t work either) node to check if I can add a widget, but it still spawns and generates errors anyways. Does the dedicated server even spawn its own character? I’m not sure why this is happening.
For reference I access the players’ state in the widget to display variables, if that affects anything
I managed to fix all errors by adding a 0.2 second delay on beginplay. I also moved it to it’s own function as to not disturb any other beginplay nodes. I remember reading about a bug that if you use beginplay without a delay to add widgets it doesn’t work correctly. I’m not sure how low the delay can be, but it has to be >0.1 I’m guessing.
Best of luck all!
My understanding of it is you need a viewport to load UI, which is managed by the camera manager…which is owned by the controller.
Characters/Pawns are spawned and then possessed. Pre-possession there isn’t a controller, thus no cam manager or viewport to reference.
The delay is used to give the GM time to have the controller possess the pawn.
So, In the character class event graph create an event “Load UI”. Pipe up your widget/viewport logic.
In the player Controller → Event Graph use the “On Possess” event to create a reference to the character and then call the Load UI event in the character class.
Bonus!
In the Controller class you can override the AController::SetPawn method to ensure you get an event to fire immediately on possession.