Add UGS Sessions online hosting with no port-forwarding

Players can now host and join over the internet without port-forwarding
via Unity Gaming Services Relay + Lobby, exposed through the unified
Multiplayer Services SDK (Sessions API).

- OnlineSessionManager: anonymous auth, CreateSessionAsync (public,
  relay-backed), QuerySessionsAsync server browser, JoinSessionByIdAsync,
  and session leave wired into the existing net-stop teardown.
- Per-install auth profile derived from the project path
  (mirror_<sha1(dataPath)>) so junction-mirror clones get distinct UGS
  player ids, avoiding the same-machine 409 LobbyConflict on join.
- Install com.unity.services.multiplayer 2.2.4 (pulls Relay/Lobby/
  Authentication/Core) and attach OnlineSessionManager to the
  NetworkManager in Main.

Loopback dev flow (NetworkBootstrap H/C/J/K) is left untouched; the
online path is additive. MatchManager and gameplay are unchanged since
Sessions starts the host/client through NGO as before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 4.8 committed 2026-06-28 10:17:28 +02:00
1 parent f706cdb5a7
commit f8b11be290
8 files changed
+385 -2

No files matched your search

+15
View File
@@ -365,6 +365,7 @@ GameObject:
- component: {fileID: 284910515}
- component: {fileID: 284910514}
- component: {fileID: 284910518}
- component: {fileID: 284910519}
m_Layer: 0
m_Name: NetworkManager
m_TagString: Untagged
@@ -494,6 +495,20 @@ MonoBehaviour:
spectatorPrefab: {fileID: 2945604797830805689, guid: 6e001668808a3d64680522e4c8d582b0, type: 3}
lobbySpawnCenter: {x: 0, y: 1, z: 0}
matchSpawnCenter: {x: 0, y: 1, z: 0}
--- !u!114 &284910519
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 284910513}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 64babb133b483be49972dd184b31d84b, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::OnlineSessionManager
maxPlayers: 8
showGui: 1
--- !u!1 &330585543
GameObject:
m_ObjectHideFlags: 0