时序图
┌──────────────────────── SERVER ────────────────────────┐ ┌──────────────────────── CLIENT ────────────────────────┐
│ Engine Start │ │ Engine Start │
│ │ │ │
│ GameInstance │ │ GameInstance │
│ (唯一 / 进程级) │ │ (唯一 / 进程级) │
│ │ │ │
│ ───────────── Load Map ───────────── │ │ ───────────── Load Map ───────────── │
│ UWorld │ │ UWorld │
│ LevelScriptActor │ │ LevelScriptActor │
│ │ │ │
│ GameModeBase (✔ Server Only) │ │ ❌ GameMode 不存在 │
│ ├─ InitGame │ │ │
│ ├─ InitGameState │ │ │
│ │ │ │
│ GameStateBase (创建 + Replicate) │◀──┼── Replicated GameState │
│ │ │ │
│ Level Actors (Placed) │ │ Level Actors (Placed) │
│ │ │ │
│ PlayerController (Server Authority) │◀──┼── PlayerController (Client Proxy) │
│ ├─ PlayerState │◀──┼── PlayerState │
│ │ │ │
│ Spawn Pawn │◀──┼── Pawn (Replicated) │
│ └─ Possess │ │ └─ OnRep_Controller │
│ │ │ │
│ ───────────── BeginPlay Phase ───────────── │ │ ───────────── BeginPlay Phase ───────────── │
│ LevelScriptActor::BeginPlay │ │ │
│ GameMode::BeginPlay │ │ │
│ GameState::BeginPlay │◀──┼── GameState::BeginPlay │
│ PlayerController::BeginPlay │◀──┼── PlayerController::BeginPlay │
│ Pawn::BeginPlay │◀──┼── Pawn::BeginPlay │
│ Other Actors::BeginPlay │◀──┼── Other Actors::BeginPlay │
│ │ │ │
│ Tick / Gameplay Logic │◀──┼── Tick / Gameplay Logic │
└────────────────────────────────────────────────────────┘ └──────────────────────────────────────────────────────────┘
所属关系
服务器拥有所有Gameplay对象,但不包含HUD。
客户端拥有自己的HUD、自己的PlayerController、GameState和所有玩家的PlayerState、Pawn。

关卡蓝图 LevelScriptActor
关卡蓝图在关卡加载完成后创建,但不会立即调用BeginPlay。其创建时间早于GameMode但晚于GameInstance。
关卡蓝图同时存在于服务端和客户端,但它不是网络复制对象,逻辑各自本地执行。

Discussion
留言讨论
发表留言时,评论服务会记录必要的 IP 与 User-Agent 信息,用于安全审核和防止滥用。