Permissions (and priviliges) can be used to validate players are authorized to use features of your game. Some platforms require checking a user’s permissions at the appropriate times before you can release your game to their store. For example, Xbox require you to check a user has the “Online Multiplayer” permission before allowing a player to access online multiplayer in your title

Code Sample - GetCachedPermission

Get a permission from the cache

public static void LogCachedPermission(PlatformPlayer player, Permission permission)
{
	PlatformPlayer.PermissionResult result = player.GetCachedPermission(permission);

	if(result == PlatformPlayer.PermissionResult.Allowed)
  {
		Debug.Log(permission.DisplayName + " is allowed!");
	}
	else
  {
		Debug.LogWarning(permission.DisplayName + " result: " + result.ToString());
  }
}

Code Sample - GetPermission

Get a permission async from the platform

public static void RefreshPermission(PlatformPlayer player, Permission permission)
{
	//set 
	player.GetPermission(permission, true, (result) =>
	{
		if(result == PlatformPlayer.PermissionResult.Allowed)
    {
			Debug.Log("Permission refreshed and allowed: " + permission.DisplayName);
    }
    else
    {
			Debug.LogWarning("Permission refreshed with result: " + result.ToString());
    }
	});
}

Flowchart Get Permission

GetPermission.drawio.png

Create a Permission Object

ex: Permission object that checks ‘Online Multiplayer’

Untitled

StaticList - Permissions

Create a gameobject with component Permissions. Assign all permissions to the List field