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
ChoosePlayerStart
can locate the pawn’s init StartSpot for you.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.)