AGameModeBase::RestartPlayerAtPlayerStart
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: virtualUFUNCTIONBlueprintCallable
Description
Spawns a player's pawn at a specific start spot actor. Use this when you have already determined the exact spawn location and want to bypass FindPlayerStart logic.
Caveats & Gotchas
- • Unlike RestartPlayer, this function does NOT call PlayerCanRestart before spawning — it will spawn even if the player is on cooldown or the game is in a state that should prevent spawning.
- • Calls InitStartSpot on the start actor before spawning, which records the start spot on the PlayerState. If you reuse start spots, this could cause future FindPlayerStart calls to return a stale saved spot.
- • The StartSpot actor must not be null; passing null will result in no spawn and a log warning. Always validate the start spot before calling this.
Signature
ENGINE_API virtual void RestartPlayerAtPlayerStart(AController* NewPlayer, AActor* StartSpot); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewPlayer | AController* | The controller for the player to spawn. | — |
| StartSpot | AActor* | The actor (usually a PlayerStart) defining the spawn location and rotation. | — |
Return Type
void Example
Spawn player at a specific checkpoint C++
void AMyGameMode::SpawnAtCheckpoint(APlayerController* PC, AMyCheckpoint* Checkpoint)
{
if (PC && Checkpoint)
{
RestartPlayerAtPlayerStart(PC, Checkpoint);
}
} Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?