I noticed something. When I unplug the true branch where I check whether the level is loaded and visible in BP_PC Begin Play and do not call the server rpc, the pawn is spawned nonetheless ! So I was wondering how this can happen and I came across the 4 overridable functions from GM:
HandleStartingNewPlayer
Choose Player Start
Player Can Restart
Spawn Default at Transform
If HandleStartingNewPlayer Event doesn’t call a parent function, it will block the spawning chain, right?
So in Begin Play of BP_PC (My Player Controller), I can wait till the level is loaded+visible, then call a Server_RPC with the client as input and manually call “ChoosePlayerStart” and afterwards “SpawnDefaultAtTransform”?
I’d love to override “Player Can Restart” where I pass a boolean as an input. But it appears as if I can’t pass an input parameter to this function when I want to override it. So I just override it and set it to false always - just in case if HandleStartingNewPlayer leaving empty doesn’t work / isn’t enough to block the spawning chain.
This would be my solution. I’ll implement this after I catched some sleep
I am totally confused. I tried what I wrote above. Did not work.
My 2nd approach:
I implemented a boolean in BP_PC “bHasLoadedLevel”
I overrode “Player Can Restart” where I use the input PlayerController object from the function to get the bHasLoadedLevel and directly pass it to the return node to prevent spawning when the level isn’t loaded yet.
→ While both clients (Host/Client 1) spawn their characters, host’s pawn is not controllable
Possible soft-lock
Someone told me that client loads the stream level faster than server.
Therefore, the server can’t catch up and soft-locks the client and prevents him from spawning.
My 3rd approach
My idea was to use switch has authority on BP_PC Begin Play where I use the authority pin to load the Stream Level. When I use this way, I can save a boolean afterwards “bServerLoadedLevel”
After this, I use a switch has authority for the remote pin and repeat this procedure where I save a boolean “bClientLoadedLevel”.
And in “Player Can Restart” I’d use these 2 booleans from the player controller object to do a AND-Boolean check and pass it to the return node.
When the bClientLoadedLevel is set, I’d use a Server RPC to do “Restart Player”.
→ I know what you wrote there with " Dont use RPCs in Begin Play". But I have no idea how else I can do it.
the problem
→ Both clients are in spectating view. No pawn spawned
What I noticed in 2nd/3rd approach
In Debug Mode when I plug in a debug modifier on Begin Play, the debug flow stops at Load Stream by Level.
So I can never see the rest what happens next
But when I unplug the server RPC “Notify Level Loaded”, the pawns are never spawned in 2nd approach. So they must be executed although I can’t see it in debug mode.