Sample | Monitor all rooms for Unity Cloud scenes from a workspace
You can use this sample to monitor all rooms attached to Unity Cloud scenes from a workspace to retrieve information about their participants.
Prerequisites
To use the sample, you require the following:
- An installed Presence package
- An installed Identity package
- An installed Storage package
- A valid Unity ID
- A Unity Cloud scene associated with your Unity ID
Note: While the Presence package doesn't depend on the Storage and Identity packages, they're used in this sample to control the authentication flow.
Installation
To install the sample, follow these steps:
- In your Unity project, go to Window > Package Manager > Unity Cloud Presence.
- Expand Samples and select Import beside the All Rooms Monitoring sample.

After the import process completes, you can view the imported assets under the Assets/Samples/Unity Cloud Presence folder.

Run the sample
Note: For a better user experience, do one of the following to join a room using the Room Monitoring sample while monitoring using the All Rooms Monitoring sample:
- Build and run the Room Monitoring sample scene (refer to Sample | Monitor and join rooms in Unity Cloud scenes). Join a room in a workspace while running the All Rooms Monitoring sample in the editor. Monitor the workspace that has the joined room in the Room Monitoring sample build.
- Run the Room Monitoring and All Rooms Monitoring samples in two instances of the Unity Editor at the same time.
To run the sample, follow these steps:
- In your Unity project, go to File > Open Scene.
- Go to
Assets/Samples/Unity Cloud Presence/<package-version>/AllRoomsMonitoring/Scenes/AllRoomsMonitoringSample.unityand run the scene. In the Game view, select Login if you are logged out. Log into the browser window that launches with your Unity ID account and then return to the sample scene.
Note: If you've previously logged in, the sample automatically logs you in so you can proceed to the next step.
- Select a workspace to monitor from the Workspace field.
A list of participants appear for each room attached to the selected workspace's scenes.

Main components
This section describes the scripts that make up the main components of this sample.
Platform services script
The PlatformServices class initializes and disposes of dependencies required by the Presence samples. You can use this class to manage the Unity Cloud services and dependencies you use in your application.
The PlatformServices class has two accompanying classes called PlatformServicesInitialization and PlatformServicesShutdown that call the initialization and shutdown methods through Unity's standard Monobehaviour methods Awake(), Start(), and OnDestroy().
To open the platform services script, go to the Assets/Samples/Unity Cloud Presence/<package-version>/Shared/Scripts/Services/PlatformServices.cs file.
Login manager script
The LoginManager class manages the login flow for signing in with your Unity ID. Refer to the Identity package for more information about authentication.
To open the login manager script, go to the Assets/Samples/Unity Cloud Presence/<package-version>/Shared/Scripts/Login/LoginManager.cs file.
All rooms manager sample script
The AllRoomsManager script shows how to do the following:
- Retrieve the Unity Cloud workspaces and scenes associated with your Unity ID
- Retrieve all
Roomsassociated to a workspace's scenes using aRoomProvider - Monitor all rooms for the selected workspace
To open the all rooms manager sample script, go to the Assets/Samples/Unity Cloud Presence/<package-version>/AllRoomsMonitoring/Scripts/AllRoomsManager.cs file.
Troubleshoot
This section describes issues you might have while using the sample.
Automatic browser redirection doesn't work
If you run the sample in the Unity Editor, you should see the following page after you successfully login through your browser.

If you aren't automatically redirected to the Editor and nothing happens when you select Launch Application, return to the Editor. This should continue the authentication process.
Mouse input isn't registered
This sample isn't created to run with the Input System package. If you're using this package in your project, your mouse selections may not be detected.
To fix this, set your project to support both the built-in input system and the Input System package: go to Edit > Project Settings > Player and set Active Input Handling to Both.
