title, type, tags, sources, last_updated
| title |
type |
tags |
sources |
last_updated |
| Netcode for GameObjects |
entity |
| unity |
| networking |
| framework |
|
| unity-multiplayer-engineer |
|
2026-04-26 |
Aliases
- NGO
- Netcode for GameObjects (NGO)
Type
Unity 官方多人游戏网络框架
Definition
Netcode for GameObjects(NGO)是 Unity 官方提供的多人游戏网络编程框架,提供 NetworkObject、NetworkVariable<T>、ServerRpc、ClientRpc 等核心网络原语,简化服务器权威多人游戏开发。
Core Components
| 组件 |
类型 |
用途 |
NetworkObject |
组件 |
挂载到 GameObject 使其可联网 |
NetworkVariable<T> |
类型 |
持久化状态同步 |
ServerRpc |
特性 |
客户端调用 → 服务器执行 |
ClientRpc |
特性 |
服务器调用 → 所有客户端执行 |
NetworkManager |
组件 |
网络管理器 |
UnityTransport |
组件 |
底层传输层(支持直连/Relay) |
Key Design Decisions
- 服务器权威:所有 NetworkVariable write 权限默认为 Server
- 自动同步:NetworkVariable 变化自动同步,无需手动调用
- Prefabs 注册:所有联网 Prefab 必须注册到 NetworkPrefabs 列表
Related Concepts
Related Entities