/
GetCurrentSpaceUsers (Unity)

GetCurrentSpaceUsers (Unity)

- 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 when called, and will not be updated as users join/leave.

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

- Sample

public class SpaceStateUtility : MonoBehaviour { private CavrnusSpaceConnection spaceConn; public void Start() { CavrnusFunctionLibrary.AwaitAnySpaceConnection(spaceConn => this.spaceConn = spaceConn); } public void PrintCurrentUsersToConsole() { var users = spaceConn.GetCurrentSpaceUsers(); foreach (var user in users) { Debug.Log($"{user.ContainerId} is {user.GetUserName()}"); } } }

Related content

BindSpaceUsers (Unity)
BindSpaceUsers (Unity)
More like this
AwaitLocalUser (Unity)
AwaitLocalUser (Unity)
More like this
SpawnObject (Unity)
SpawnObject (Unity)
Read with this
GetCurrentSpaceUsers (.NET)
GetCurrentSpaceUsers (.NET)
More like this
SetLocalUserStreamingState (Unity)
SetLocalUserStreamingState (Unity)
Read with this
GetCurrentSpaceUsers (Unreal Engine)
GetCurrentSpaceUsers (Unreal Engine)
More like this