Why can't I add widgets to my GameViewport on a client?

So I’ve basically adapted the Shooter Game Main Menu UI into my game, however I’m running across a strange problem. I’ve found that when I run as a client, I can’t access my Game Viewport.

So this: GEngine->GameViewPort
is null, and when I try to get my Player Controller’s Local Player, that I can’t get the Local Player. So I can’t get the GameViewPort LocalPlayer->ViewportClient either.

Now, this was called inside of the Game Mode’s Begin Play, but I changed it to my Player Controller’s Begin Play. So it works in neither, although I’m not sure if that has any effect (I’m curious if the viewport isn’t assigned to a client yet).

But I do know that in some other code I have, a HUD’s begin play call does call GEngine->GameViewPort, and that always works. So I’m not sure what is going on and causing issues here.

Is this a known problem? Is there any fix or workaround?

1 Like

#HUD

You could just add the widgets to the HUD class instead :slight_smile:

Clients guaranteed to have that!

Rama