文档

​
​

Development

User Acquisition

Monetization

工业

Multiplayer Services SDK

All Services

Multiplayer Services SDK

此页面不支持所选语言。
Multiplayer
​
​
Multiplayer Services SDK
  • Overview
  • Get started
  • Use multiplayer sessions
  • Manage sessions
  • Connect players through a relay
    • Relay servers
    • Players
    • Relay integrations
    • Fair usage
    • Limitations
  • Networking
  • Matchmaking
  • Monitor and debug sessions
  • Tutorials
  • Reference
  1. Multiplayer Services SDK

Relay integration

Integrate Unity Relay with Lobby to enable synchronized disconnects and secure peer-to-peer communication between players.
阅读时间1 分钟
最后更新于 2 个月前

注意
Interoperability between Relay and Lobby is handled for users when using Multiplayer sessions. However you can use additional settings for more fine grained control over your relay and lobby multiplayer set up.
Using the Relay service isn't a requirement for using the Lobby service, but if you're using Relay, you can set Relay-related properties on a lobby to enable synchronized disconnects between Relay and Lobby. If you register a player's Relay information with the lobby, and that player disconnects or is disconnected from the Relay server they're connected to, the Relay service sends a notification to the Lobby service so that the disconnected player is removed from that lobby. Refer to the Relay documentation for more information about Relay and the Lobby config options for more details about configuring player disconnects.
To enable Relay integration with the Lobby service, set the AllocationID for each player whenever a player is in a lobby and is using a Relay server. The AllocationID for the player who sets up the allocation (most likely the lobby host) should be the allocation ID returned by the CreateAllocationAsync API call. All other players in the lobby who join that allocation should instead use the allocation ID returned by their respective JoinAllocationAsync API calls.
注意
When you are using Relay integration and the Relay host disconnects from the Relay, the host is removed from the lobby. Other players are also disconnected from the Relay at this time (because the host is gone), but they are not disconnected from the lobby. For more information, refer to the Host migration documentation.

Copyright © 2026 Unity Technologies
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。


    报告此页面的问题