Roles
Roles are a convenient way to identify users in your session. Each user can have multiple roles, and each role can be assigned to multiple users, unless it is marked as unique. Roles exist as unity assets and be created from the menu Create > Immerse > Multiplayer > Role.
Before a role can be assigned, it must first be registered in the Roles list in the SDK multiplayer settings. This assigns an ID to the role so it can be identified in a networked environment.
Unique roles can only be assigned to one user at a time. If a unique role is assigned to a different user, it will first be unassigned from the current user before being reassigned.
Each role includes a description field. This field does not have any functional utility and is included solely for developer reference.
The User List window is a great tool for testing roles as you can easily see which roles a user has and assign/unassign them directly from the window.
Assigning code is done via code. See below for an example of how to assign a role
using ImmerseSDK.Multiplayer.Roles;
user.AssignRole(_role);
Un-assigning a role can be done similarly:
using ImmerseSDK.Multiplayer.Roles;
user.UnassignRole(_role);