...
- Description
Throws events whenever CavrnusUsers enter/exit the given space.
...
This is the best way to maintain a list of users in, say, a UI panel. If you just want a snapshot of the current users for, say, debugging, consider calling GetCurrentSpaceUsers.
- Sample
Code Block | ||
---|---|---|
| ||
public class SpaceUserAudioController : MonoBehaviour { [SerializeField] private AudioSource audioSource; [SerializeField] private AudioClip joinClip; [SerializeField] private AudioClip exitClip; public void Start() { CavrnusFunctionLibrary.AwaitAnySpaceConnection(spaceConn => { spaceConn.BindSpaceUsers(UserJoined, UserExited); }); } private void UserJoined(CavrnusUser user) => audioSource.PlayOneShot(joinClip); private void UserExited(CavrnusUser user) => audioSource.PlayOneShot(exitClip); } |