Get started
To begin using the Presence package, you must first set up an app identifier and initialize the service.
Set up an app identifier
To set up an app identifier, follow the steps in the Identity package starter guide.
Initialize the service
To initialize your service, see the following steps:
In your
PlatformServices
script, update thePlatformServices
class with public references toIRoomProvider<Room>
andISessionProvider
and a private reference toPresenceManager
.static PresenceManager s_PresenceManager; public static IRoomProvider<Room> RoomProvider => s_PresenceManager; public static ISessionProvider SessionProvider => s_PresenceManager;
Initialize the services in the
InitializeAsync
method. The variables provided in the constructor are defined in the Identity authentication guide.public static async Task InitializeAsync() { // ... s_PresenceManager = new PresenceManager(AccessTokenProvider, playerSettings, s_CloudConfiguration); // ... }
Shut down the services in the
Shutdown
method.public static void Shutdown() { // ... s_PresenceManager.Dispose(); s_PresenceManager = null; // ... }
Manage the package stripping level
To avoid runtime errors when building with this package, follow these steps:
- In your Unity project window, go to Edit > Project settings.
The Project setting window opens. - Select the Player option.
- Scroll to the Additional Compiler Arguments section.
- Set the Managed stripping level option to:
- Disabled
or - Minimal (if the Disabled option isn't available)