AGameModeBase::SpawnPlayerFromSimulate
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: virtual
Description
Spawns a player into a running PIE session when the editor transitions from Simulate mode to Play mode. Returns true if the player was successfully spawned.
Caveats & Gotchas
- • This is an editor-only code path and is never invoked in standalone or shipping builds. Do not place runtime game logic here.
- • The game may already be mid-match when this fires because Simulate mode runs the game without a player. Override it if your GameMode needs special late-join handling for players entering through simulation.
Signature
ENGINE_API virtual bool SpawnPlayerFromSimulate(const FVector& NewLocation, const FRotator& NewRotation); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewLocation | const FVector& | World location at which to spawn the player when entering PIE from Simulate mode. | — |
| NewRotation | const FRotator& | World rotation for the spawned player controller. | — |
Return Type
bool Example
Sync late-join state when entering PIE from Simulate C++
bool AMyGameMode::SpawnPlayerFromSimulate(const FVector& NewLocation, const FRotator& NewRotation)
{
bool bSuccess = Super::SpawnPlayerFromSimulate(NewLocation, NewRotation);
if (bSuccess)
{
SyncLateJoinPlayer();
}
return bSuccess;
} Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?