Info
- Backend = ServiceHub REST API at
https://polis.lics.cz/api (default in ServiceHubSettings). Backend docs: Service Hub, endpoints in API
- Unity client side lives in Polis Core (
Packages/PolisCore): ServiceHub/ (API modules, Polis.Core.ServiceHub, streaming in ServiceHub/Streaming, releases in ServiceHub/Releases and ServiceHub/ReleaseContent, crash reports in ServiceHub/CrashReporting, analytics in ServiceHub/Analytics, terms and privacy in ServiceHub/Legal) and RemoteContent/ (spawning shared content). REST helpers are in Http/ (Polis.Core.Http). PurrNet glue (authenticator, server list adapter, requirements) is in Networking/ServiceHub and Networking/ServerManagement/ServiceHub.
- Server side features: user / server auth, save data, lobby (server list + join codes), remote content library, presence and streams, port probe, releases (content builds by collection, channel and platform), crash reports, analytics, terms and privacy policy. Each service can be turned on or off per app.
Setup
- Prefab
Multiplayer/ServiceHub/ServiceHubManager.prefab in the XR content kit, load item ServiceHubManagerLoader (kit App/AppLoading/Data/LoadItems, see App Loader).
- Settings SO
ServiceHubSettings in the project (e.g. Settings/ServiceHubSettings.asset, Create > Polis/ServiceHub/ServiceHubSettings), addressable with the Settings label, read with AppSettings.Get<ServiceHubSettings>():
ServiceBaseUrl, AppSecret (identifies the app on the backend, without it the manager logs an error and does nothing). The secret is on the app's App Settings page in the console.
ApiTimeoutSeconds, AuthTimeoutSeconds (min 3 s), ContentTimeoutSeconds (whole content download, default 120 s), BatchSaveDataSyncInterval (default 30 s).
AnonymousLoginByDefault (on by default), LoginProviders (provider buttons on the login screen), see Auth.
ServiceHubManager : ALoadableServiceBehaviour<ServiceHubManager> holds all modules as child components and calls Initialize(settings) on each (IServiceHubModule):
ClientAuth, ServerAuth, SaveData, RemoteContent, Lobby, Probe, Connectivity.
Presence - optional, needed for streaming.
Releases - optional, needed for release content, see Release Content.
- Access:
AppCore.Services.Get<ServiceHubManager>().SaveData etc.
- Own services next to it, each with a kit prefab and load item that waits for the manager:
CrashReportingManager (only with the Sentry package, see Crash Reports) and AnalyticsManager (see Analytics). Terms and privacy: Legal
- On load it checks a stored client session (
/auth/me) in the background, the app load doesn't wait for it. Requests meanwhile use the stored session. Without a session it signs in anonymously, unless the user logged out. On app pause it flushes pending save data (Quest can kill the app without OnApplicationQuit).
Optional services
- Lobby, Servers, Streams, Save data, Content, Releases, Crash reports and Analytics are turned on per app in the console (App Settings)
AppServices.IsEnabled(AppService.X) - read from app_services of the signed-in user. Before a sign-in lists them everything counts as on
- An endpoint answering
ServiceDisabled (32) turns the service off until the next user info refresh. AppServices.Changed fires on every change
- Off services stay quiet: save data stays local, a hosted session is only found on the local network, content and streams hide, release content starts from its cached release, crash reports stop, analytics records nothing
RequirementOverlay - covers a window while a requirement is missing (ServiceRequirement, SignInRequirement, NetworkRequirement, ContentRequirement). The first missing one picks the look, an optional window button to fix it and a progress bar while it reports progress (e.g. a content download). Own requirements inherit AWindowRequirement
Errors
ServiceHubStatus mirrors the backend status codes (see API), read from NetworkResponse.ApiStatus
ServiceHubErrors.Classify(statusCode, apiStatus) → ServiceHubError (Failed, Unreachable, TooManyRequests, SignedOut, ServiceOff, NotFound). UI maps it to a localized message, e.g. the content library