Order of execution for logging into service

Following the chat channel sample demo scene, I pretty much just copied and pasted the code. Instead of clicking a button to login I just add the login to the start as such from the LoginScreenUI.cs:

private void Awake()
    {
        _vivoxVoiceManager = VoiceManager.Instance;
        _vivoxVoiceManager.OnUserLoggedInEvent += OnUserLoggedIn;
        _vivoxVoiceManager.OnUserLoggedOutEvent += OnUserLoggedOut;

#if !(UNITY_STANDALONE || UNITY_IOS || UNITY_ANDROID || UNITY_STADIA)
        DisplayNameInput.interactable = false;
#else
       // DisplayNameInput.onEndEdit.AddListener((string text) => { LoginToVivoxService(); });
#endif
        //LoginButton.onClick.AddListener(() => { LoginToVivoxService(); });

        if (_vivoxVoiceManager.LoginState == VivoxUnity.LoginState.LoggedIn)
        {
            OnUserLoggedIn();
            //DisplayNameInput.text = _vivoxVoiceManager.LoginSession.Key.DisplayName;
        }
        else
        {
            OnUserLoggedOut();
            var systInfoDeviceName = String.IsNullOrWhiteSpace(SystemInfo.deviceName) == false ? SystemInfo.deviceName : Environment.MachineName;

            //DisplayNameInput.text = Environment.MachineName.Substring(0, Math.Min(defaultMaxStringLength, Environment.MachineName.Length));
        }
    }

    private void Start()
    {
        LoginToVivoxService();
    }

private void LoginToVivoxService()
    {
        if (IsMicPermissionGranted())
        {
            // The user authorized use of the microphone.
            LoginToVivox();
        }
        else
        {
            // We do not have the needed permissions.
            // Ask for permissions or proceed without the functionality enabled if they were denied by the user
            if (IsPermissionsDenied())
            {
                PermissionAskedCount = 0;
                LoginToVivox();
            }
            else
            {
                AskForPermissions();
            }
        }
    }
    private void LoginToVivox()
    {
        //LoginButton.interactable = false;
 /*       if (string.IsNullOrEmpty(DisplayNameInput.text))
        {
            Debug.LogError("Please enter a display name.");
            return;
        }*/
        _vivoxVoiceManager.Login(Guid.NewGuid().ToString());
    }

Seems like the name parameter on AccountID is provided by Vivox? In the example scene it does not appear that the user creates name.

Any advice?

Hello, can you provide me with some more information before I can help:

  • What version of Vivox are you using?
  • What version of the Unity Editor are you using?
  • Do you have your project linked to your account in the Unity Dashboard?
  • Can you please verify that the same code works if you use your LoginButton?

I going to close out this forum post due to inactivity. I hope this is because you were able to resolve your issue. If you are still experiencing issues or run into another problem, please create a new forum post.