I created a Game mode blueprint inheriting from a C++ Game mode, and what i’d like to do is to set two different pawn, one for my client and another one for my server, and i set this into my BeginPlay Event, but i figured out that the Game mode is executed before Begin Play, and when i set defaultPawn into my game mode the change took effect only after that the player has been spawned, is there anything wrong with what i’ve done ?
Essentially the PlayerController will attach itself to the Game Mode which will of course happen after the Game Mode has loaded.
Now since you are getting the Player Index 0, it won’t work anyway, since every Client (considering the Server also as Client since you want to play on it) has its own Player Controller. What I would do is to define this in the Player Controller itself and by possessing, depending if you are on the server or not, the appropriate pawn.
Thanks for your answer, but even if i put it on the player controller i got the same result, i found Event Post Login who are executed once a player is connected and then before BeginPlay and since the game mode run only on server and that containt also the client, i’ve made a loop for all actors, but still getting the same pawn, even if my bool variable change state and pass trought my true and false branch state, i got the same pawn is there any other issus to indicate which pawn a player could take into my game state ? here’s what i’ve done
I have had issues with begin play in gamemode, i use a delay node (0.5s) right after begin play to fix it. I takes so times (something really small like 0.2s) to get everything initialized, for example if i try to get the players array in the gamestate without the small delay, it fails. Not sure it is this problem you are having tho, try it :).
Edit : Same thing for the player controller, if i try to get the gamemode at begin play it will fail without a really really small delay (0.01).
The fact is, when i press the play button, an automatically default pawn is spawned on the server, and just after that, the game mode check my first condition who is on the Event Begin Play and which is supposed to run on my server and spawn the thief player for it, but instead the thief player is spawned for the client… and when i added the delay, weird stuff happened then, sometime the same character is spawned and sometime not, knowing that is the same code who is executed several time but got different results… i’m really lost