Download

InitStartSpot Behavior and Moving the Player Spawn

Is InitStartSpot supposed to be called after SpawnDefaultPawnFor in RestartPlayer? It seems like the perfect place to adjust the StartSpot before the player Pawn is spawned there. Unfortunately the player’s pawn is spawned before InitStartSpot is called.

In our game I save the player’s position on the world map before transition to a local map. Then, when the player returns to the world map I restore the saved position. The way I ended up doing this is to re-implement SpawnDefaultPawnFor to adjust the StartSpot there. Does this method sound good, or is there another recommended solution?

Thanks!

If you only want to control which PlayerStart the player is spawned at, its better to override ChoosePlayerStart:

GameMode.h:



UFUNCTION(BlueprintNativeEvent, Category="Game")
class AActor* ChoosePlayerStart( AController* Player );


Since its a blueprint native event, be sure to override it in your GameMode subclass as:



AActor* AMyCustomGameMode::ChoosePlayerStart_Implementation(AController* Player)


ChoosePlayerStart is called before SpawnDefaultPawnFor to determine which start spot to spawn at. You can call Super::ChoosePlayerStart here to grab a spawn spot via the default behavior, then move it as you see fit before returning it.