AGameModeBase::RestartPlayerAtTransform
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: virtualUFUNCTIONBlueprintCallable
Description
Spawns or respawns a player's pawn at a specific world transform instead of at a player start actor. Use this for checkpoint respawns, team spawners, or scripted spawn locations.
Caveats & Gotchas
- • This bypasses normal player start selection and collision-avoidance logic entirely. If you need spawn overlap handling, implement it yourself before calling this function.
- • Calling this on a controller that already has a live pawn destroys the old pawn first without firing any death or cleanup events. Handle death notifications before respawning if your game tracks them.
Signature
UFUNCTION(BlueprintCallable, Category=Game)
ENGINE_API virtual void RestartPlayerAtTransform(AController* NewPlayer, const FTransform& SpawnTransform); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewPlayer | AController* | The controller to restart or respawn. | — |
| SpawnTransform | const FTransform& | The world transform at which to spawn the player's pawn. | — |
Return Type
void Example
Respawn a player at a saved checkpoint location C++
void AMyGameMode::RespawnAtCheckpoint(AController* Player, const FTransform& CheckpointTransform)
{
if (Player && HasAuthority())
{
RestartPlayerAtTransform(Player, CheckpointTransform);
}
} Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?