Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

- Declaration

public static async void Task<CavrnusUser> AwaitLocalUser(this CavrnusSpaceConnection spaceConnection, Action<CavrnusUser> localUserArrived)

- Description

Triggers localUserArrived Completes when the local user becomes present in the given space. Normally there is a delay between first calling JoinSpace and the local user fully connecting/setting up.

If the local user is already present localUserArrived this will trigger complete immediately.

- Sample

Code Block
languagec#
public class WelcomeUserUI : MonoBehaviour
{
    [SerializeField] private TextMeshProUGUI userName;
    
    public void Start()
    {
        CavrnusFunctionLibrary.AwaitAnySpaceConnection(spaceConn => {
            spaceConn.AwaitLocalUser(ShowUI);
        });
    }

    private void ShowUI(CavrnusUser localUser)
    {
        userName.text = $"Welcome, {localUser.GetUserName()}!";
    }
}//Coming soon!