Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

- Declaration

public static List<CavrnusUser> GetCurrentSpaceUsers(this CavrnusSpaceConnection spaceConn)

- Description

This gives a list of all CavrnusUsers currently in the space. Note that this list may be empty if called too soon after JoinSpace.

This list will only provide a snapshot of the user states, and will not be updated as users join/leave.

For a more robust/maintained list of users consider calling BindSpaceUsers.

- Sample

public class StreamingMenu : MonoBehaviour
{
    private CavrnusSpaceConnection spaceConn;
    
    public void Start()
    {
        CavrnusFunctionLibrary.AwaitAnySpaceConnection(spaceConn => this.spaceConn = spaceConn);
    }

    private void OnEnable()
    {
        var users = spaceConn.GetCurrentSpaceUsers();
        var usersStreaming = users.Where(user => user.GetUserStreaming());

        foreach (var user in usersStreaming) {
            Debug.Log($"{user.GetUserName()} is streaming!");
        }
    }
}
  • No labels