OnPostLogin spawn issue

You need a localplayer override in project settings. This is due to the client posession of a non replicated controller without a cameramanager for a brief second and has been mentioned in UDN on how to properly address. Set the camera manager on your localplayer class to construct as set fade to solid black and once it hits posession after repped fade back in

I am having an issue when a player joins my game there is a quick flash of a camera sitting at what looks like 0,0,0. The Server player doesn’t not have the issue, I am guessing because the server is actually loading the world. However when a client joins the servers session, they get a quick flicker of a camera sitting at (0,0,0), before I manually spawn them to their correct PlayerStart. I manually spawn them in my GameMode right after OnPostLogin.

TL;DR

Override ChoosePlayerStart and SpawnDefaultPawnFor functions in GameModeBase might solve this issue.(UE5.03)

Steps

  1. ChoosePlayerStart can locate the pawn’s init StartSpot for you.
  2. SpawnDefaultPawnFor can adjust the pawn with the StartSpot info you provided.

Story

After finding myself has the same issue of camera fickering,I first tried to override ChoosePlayerStart function. But that just make my pawn spawn at the right place with no rotation info at all.Then with some trial and error iterating,a NPE happened to me,and I got a call stack below:

Then I found that after PostLogin(here I’ve once tried to SetViewTarget of the PlayerController,which turned out to be in vain…), GameMode tried to spawn a default pawn for the login-ed player controller after PostLogin, but without rotation info of the StartPot! But lucky enough, SpawnDefaultPawnFor is also overridable.
At last, I overrode the 2 functions and the pawn spawned with a correct transform at the first place without flickering.

But…

If I directly open the map without JoinSession(In PIE), the flicker appears…
(In my case, I have a openning stage and an animation when the game starts,so there’s nothing to worry though.)

@TimBayer Hi!

As far as I know, it happens because Player Controller spawns Camera Manager before possess character. The Camera Manager starts the camera view as soon as it is created, and then waits for the character’s camera to replicate transform.

So you can override Player Controller’s SpawnPlayerCameraManager function and do camera fade for example, or what ever you want to hide this quick period of time.

Here is example:
image

I would spawn a widget “begin play” of the player controller. after posses a pawn, pawn or you can remove that widget

Personally I use custom Loading pawn (GM default pawn class). Bare bones pawn class, no movement, input/IMC. It has a loading screen widget.

This class determines when the clients level has loaded sufficiently, then calls an event on the controller to have the GM swap out for the character.

Works well. I get a loading screen, my pawn isn’t falling through the map, and the GM’s default new player logic/handling isn’t modified.

(post deleted by author)