After multiplayer ServerTravel, the initial play of the server role’s playercontroller is faster than that of the gamemode, which is normal in the editor. However, after packaging, the above issue occurred.
ok? spawn order is not guaranteed. What problem does this create?
I want to obtain the variable with the set value in the gamemode’s beginplay in the playercontroller’s beginplay. If the playercontroller’s beginplay is executed first, I can only obtain the initial value. I am using another method now. Check if the value is correctly obtained in Tick and read it again.
The online search results all say that the gamemode’s beginplay will precede the playercontroller’s beginplay, but when I have two players, when Servertravel reaches another map, the playercontroller executes first.
Creating a GameMode dependency in PlayerController is probably not a good idea – PlayerControllers can exist where there is no GameMode (notably network clients, or as you’ve discovered, on the network server before the GameMode exists). There is probably a better way to do it, but would require more knowledge about the interaction.
Thank you for your answer
On initial connection with a server the game mode exists before any controller.
On server travel the client already has a controller… still connected to a session.
So when you travel you need to re-poll everything.