Files
nexus/wiki/concepts/UnityLobby.md
2026-04-26 12:02:53 +08:00

40 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Unity Lobby"
type: concept
tags: [networking, unity, ugs, matchmaking]
sources: [unity-multiplayer-engineer]
last_updated: 2026-04-26
---
## Aliases
- Unity Gaming Services Lobby
- UGS Lobby
- Unity Matchmaking Lobby
## Definition
Unity Lobby 是 Unity Gaming ServicesUGS提供的**匹配大厅服务**允许玩家创建和加入游戏房间。Lobby 仅存储元数据(如房间名、地图选择、玩家就绪状态),不存储游戏状态。
## Data Storage Rules
| 数据类型 | 示例 | 存储位置 |
|----------|------|----------|
| 元数据 | 房间名、地图、游戏模式 | Lobby Data |
| 玩家状态 | 名称、就绪、皮肤选择 | Lobby Data / Player Data |
| **游戏状态** | 生命值、位置、分数 | **禁止存储在 Lobby** |
## Visibility Options
- `Visibility.Public`: 对所有玩家可见
- `Visibility.Member`: 仅房间内成员可见
- `Visibility.Private`: 仅指定玩家可见
## Heartbeat Requirement
Lobby 默认 30 秒无心跳自动销毁,需客户端定期调用 `SendHeartbeatPingAsync`(建议每 15 秒)。
## Related Concepts
- [[UnityRelay]]: 与 Relay 配合Relay 处理网络连接Lobby 处理匹配
- [[AntiCheatArchitecture]]: Lobby 不应存储游戏状态,防止数据泄露
- [[UnityGamingServices]]: Lobby 是 UGS 的核心组件
## Related Entities
- [[UnityGamingServices]]: Lobby 所属的服务平台
- [[UnityMultiplayerEngineer]]: 配置和使用 Lobby 的专家角色