Search Unity

Resolved Order of execution for logging into service

Discussion in 'Vivox (Voice & Text Chat)' started by MrPapayaMan, Sep 1, 2022.

Thread Status:
Not open for further replies.
  1. MrPapayaMan

    MrPapayaMan

    Joined:
    Feb 16, 2021
    Posts:
    42
    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:

    Code (CSharp):
    1. private void Awake()
    2.     {
    3.         _vivoxVoiceManager = VoiceManager.Instance;
    4.         _vivoxVoiceManager.OnUserLoggedInEvent += OnUserLoggedIn;
    5.         _vivoxVoiceManager.OnUserLoggedOutEvent += OnUserLoggedOut;
    6.  
    7. #if !(UNITY_STANDALONE || UNITY_IOS || UNITY_ANDROID || UNITY_STADIA)
    8.         DisplayNameInput.interactable = false;
    9. #else
    10.        // DisplayNameInput.onEndEdit.AddListener((string text) => { LoginToVivoxService(); });
    11. #endif
    12.         //LoginButton.onClick.AddListener(() => { LoginToVivoxService(); });
    13.  
    14.         if (_vivoxVoiceManager.LoginState == VivoxUnity.LoginState.LoggedIn)
    15.         {
    16.             OnUserLoggedIn();
    17.             //DisplayNameInput.text = _vivoxVoiceManager.LoginSession.Key.DisplayName;
    18.         }
    19.         else
    20.         {
    21.             OnUserLoggedOut();
    22.             var systInfoDeviceName = String.IsNullOrWhiteSpace(SystemInfo.deviceName) == false ? SystemInfo.deviceName : Environment.MachineName;
    23.  
    24.             //DisplayNameInput.text = Environment.MachineName.Substring(0, Math.Min(defaultMaxStringLength, Environment.MachineName.Length));
    25.         }
    26.     }
    27.  
    28.     private void Start()
    29.     {
    30.         LoginToVivoxService();
    31.     }
    32.  
    33. private void LoginToVivoxService()
    34.     {
    35.         if (IsMicPermissionGranted())
    36.         {
    37.             // The user authorized use of the microphone.
    38.             LoginToVivox();
    39.         }
    40.         else
    41.         {
    42.             // We do not have the needed permissions.
    43.             // Ask for permissions or proceed without the functionality enabled if they were denied by the user
    44.             if (IsPermissionsDenied())
    45.             {
    46.                 PermissionAskedCount = 0;
    47.                 LoginToVivox();
    48.             }
    49.             else
    50.             {
    51.                 AskForPermissions();
    52.             }
    53.         }
    54.     }
    55.     private void LoginToVivox()
    56.     {
    57.         //LoginButton.interactable = false;
    58.  /*       if (string.IsNullOrEmpty(DisplayNameInput.text))
    59.         {
    60.             Debug.LogError("Please enter a display name.");
    61.             return;
    62.         }*/
    63.         _vivoxVoiceManager.Login(Guid.NewGuid().ToString());
    64.     }
    65.  



    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?
     
  2. dylan_unity3d

    dylan_unity3d

    Unity Technologies

    Joined:
    Nov 12, 2019
    Posts:
    78
    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?
     
  3. dylan_unity3d

    dylan_unity3d

    Unity Technologies

    Joined:
    Nov 12, 2019
    Posts:
    78
    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.
     
Thread Status:
Not open for further replies.