Skip to content

Instantly share code, notes, and snippets.

@FullStackIndie
Last active November 11, 2022 22:08
Show Gist options
  • Save FullStackIndie/f93eafe3cd99e3f7cefa5d9e0431f2c4 to your computer and use it in GitHub Desktop.
Save FullStackIndie/f93eafe3cd99e3f7cefa5d9e0431f2c4 to your computer and use it in GitHub Desktop.
How to use Vivox from Scratch
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