APawn::PawnClientRestart
#include "GameFramework/Pawn.h"
Access: public
Specifiers: virtual
Description
Called on the owning client of a player-controlled pawn when it is restarted (usually after possession). Override to set up any client-side state — input bindings, camera, HUD — that can only be done once the controlling player is known.
Caveats & Gotchas
- • Only called on the owning client (and in standalone). Remote clients and the server never call this — use Restart() for server-side restart logic and guard client-only code accordingly.
- • Always call Super::PawnClientRestart() — the base implementation calls Restart() and enables input. Skipping it means input won't be set up for the pawn.
- • Called by DispatchRestart when bCallClientRestart is true; if you need to trigger it manually, prefer DispatchRestart over calling PawnClientRestart directly to keep the server/client flow consistent.
Signature
virtual void PawnClientRestart() Return Type
void Example
Set up camera arm on client restart C++
void AMyPawn::PawnClientRestart()
{
Super::PawnClientRestart();
// Reset spring arm boom length for this player's view
if (SpringArmComponent)
{
SpringArmComponent->TargetArmLength = DefaultArmLength;
}
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?