Last active
November 11, 2022 22:08
-
-
Save FullStackIndie/f93eafe3cd99e3f7cefa5d9e0431f2c4 to your computer and use it in GitHub Desktop.
How to use Vivox from Scratch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using VivoxUnity; | |
public class VivoxSetup : MonoBehaviour | |
{ | |
public static VivoxUnity.Client Client { get; private set; } | |
private void Awake() | |
{ | |
Client = new VivoxUnity.Client(); | |
} | |
private void Start() | |
{ | |
if (!Client.Initialized) | |
{ | |
Client.Uninitialize(); | |
Client.Initialize(SetupVivoxConfig()); | |
Debug.Log("Vivox Client is Initialized."); | |
} | |
else | |
{ | |
Debug.Log("Vivox Client is already Initialized. Skipping..."); | |
} | |
} | |
private void OnApplicationQuit() | |
{ | |
Client.Uninitialize(); | |
} | |
private VivoxConfig SetupVivoxConfig() | |
{ | |
VivoxConfig vivoxConfig = new VivoxConfig(); | |
vivoxConfig.MaxLoginsPerUser = 1; | |
vivoxConfig.InitialLogLevel = vx_log_level.log_all; | |
vivoxConfig.EnableFastNetworkChangeDetection = true; | |
return vivoxConfig; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment