文档

Development

User Acquisition

Monetization

工业

Multiplayer Services SDK

All Services

Multiplayer Services SDK

此页面不支持所选语言。
Multiplayer
​
​
Multiplayer Services SDK
  • Overview
  • Get started
  • Use multiplayer sessions
    • Integrate Multiplayer sessions
      • Initialize UGS and authenticate the player
      • Create a session
      • Create sessions in the Editor
      • Find and join a session
      • Matchmaking
      • Migrate session host
      • Leave a session
      • Get a list of joined sessions
      • Delete a session
      • Session configuration options
    • Game server hosting support
  • Manage sessions
  • Connect players through a relay
  • Networking
  • Matchmaking
  • Monitor and debug sessions
  • Tutorials
  • Reference
  1. Multiplayer Services SDK

Integrate Multiplayer sessions

Implement multiplayer functionality in your games using sessions, a unified system that manages player connections and interactions.
阅读时间3 分钟
最后更新于 8 天前

Implement multiplayer functionality in your games using sessions, a unified system that manages player connections and interactions across multiple Unity Gaming Services.
Sessions provide an abstraction layer for managing multiplayer game states, including initial player connections and gameplay interactions, and automatically handle complex multiplayer operations such as host election, players joining or leaving, and network connection establishment.
A session represents a group of connected players and manages their interactions through various connection types, including client-hosted solutions like Relay and Distributed Authority, or dedicated game servers. Sessions work with either the Netcode for GameObjects or the Netcode for Entities networking libraries.
Beginning with Unity 6.0 LTS, developers can use session operations to create their multiplayer experiences. Instead of having to manually coordinate between the SDKs for Lobby, Matchmaker, and Relay, the Multiplayer Services (MPS) SDK merges the functionality previously spread across these individual services' SDKs into a unified API centered around sessions. For example, when creating a session, the MPS SDK automatically handles lobby creation, relay allocation, and manages the Netcode connection. Similarly, while joining a session, the MPS SDK manages lobby joining, and Netcode connection establishment. This combined approach maintains all the capabilities of the underlying Unity Gaming Services (UGS) Multiplayer services while reducing implementation complexity.
Initialize UGS and authenticate the player
Initialize UGS and authenticate a player to start a multiplayer game.
Create your first multiplayer session
Create a new session, configure its connection type, and define its initial properties to start a multiplayer game.
Find and join a session
Implement ways for players to join an existing session, such as by using a join code or browsing a list of sessions.
Match players
Implement different ways to matchmake into a session by using Unity Lobby or Unity Matchmaker.
Manage properties as a host
As a session host, read, add, update, or remove session and player properties with several visibility options.
Manage properties as a client
Interact with sessions as a client by reading session properties and managing your own player properties with customizable visibility.
Migrate session host
Learn about changing session ownership, including host election and data migration.
Network connection management
Players can create and join sessions using different network connection types and configuration options.
重要
Starting with Multiplayer Services SDK version 1.2, the default network handler implementation for Netcode for Entities automatically creates client and server worlds if none are available when starting a network connection through sessions.
Older versions of the MPS SDK require you to create your Netcode for Entities client and server worlds before you can create or join a Multiplayer Services session. When you first add the Netcode for Entities package to your project, the default bootstrap automatically creates the client and server worlds at startup.
For more advanced use cases, use a custom network handler to override the default integration with Netcode for Entities.

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

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

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

  • 其他资源
  • Unity Gaming Services Multiplayer
  • Netcode for GameObjects
  • Netcode for Entities
  • Config options (Lobby)
  • 👥 **Community** Join the conversation on Unity Discussions

报告此页面的问题
​
​