Loading...
Loading...
Add and configure in-game voice chat and text chat for Unity multiplayer games using Unity Vivox. Covers microphone setup and mic permissions on Android/iOS, voice activity detection (VAD) tuning, voice volume and mute controls in a settings UI (VoiceVadMinimumVolume, mic slider, mute button, speaking indicator), proximity/3D spatial voice for FPS/co-op games, team/party/lobby/guild voice channels, push-to-talk, muting self and other players, whisper/direct messages, in-game text chat, and Vivox SDK init + Unity Authentication sign-in. Use when the user asks to add voice chat, voice comms, microphone/mic support, a voice-chat settings UI, mute button, VAD threshold, push-to-talk, proximity or spatial voice, team voice, party chat, lobby chat, direct messages, or mentions Vivox, VivoxService, com.unity.services.vivox, JoinGroupChannelAsync, JoinPositionalChannelAsync, LoginAsync, or migrating from legacy Vivox (Client.Instance / LoginSession / AccountId).
npx skill4agent add unity-technologies/skills setup-vivox-voice-chatUnity.Services.Vivoxcom.unity.services.vivoxUnity.Services.CoreUnity.Services.AuthenticationClientILoginSessionIChannelSessionVivoxService.InstanceClient.InstanceAccountIdChannelIdILoginSessionUnityPurchasing.*llms.txtusing Unity.Services.Core;
using Unity.Services.Authentication;
using Unity.Services.Vivox;
async void Start()
{
await UnityServices.InitializeAsync();
await AuthenticationService.Instance.SignInAnonymouslyAsync();
await VivoxService.Instance.InitializeAsync();
// subscribe to events (see table below) BEFORE calling LoginAsync
await VivoxService.Instance.LoginAsync(new LoginOptions { DisplayName = "Bob" });
}VivoxService.Instance.InitializeAsync()5041 VxErrorAlreadyInitializedAuthenticationServiceChannelJoined| Method | Purpose |
|---|---|
| Non-positional (party, team, lobby, guild) |
| Test channel that echoes your own audio back |
| 3D spatial audio driven by transform position |
ChatCapabilityTextOnlyAudioOnlyTextAndAudio20502 VxXmppServerErrorServiceUnavailableVivoxService.Instance.LeaveChannelAsync(channelName)LeaveAllChannelsAsync()Channel3DPropertiesTextOnlyTextAndAudioVivoxService.Instance.SendChannelTextMessageAsync(string channelName, string message)VivoxService.Instance.ChannelMessageReceivedAction<VivoxMessage>VivoxService.Instance.SendDirectTextMessageAsync(string playerId, string message)VivoxService.Instance.DirectedMessageReceivedAction<VivoxMessage>SendDirectTextMessageAsyncSendDirectedTextMessageAsyncDirectedMessageReceivedVivoxMessageChannelNameSenderDisplayNameSenderPlayerIdMessageTextReceivedTimeLanguageFromSelfMessageIdEditChannelTextMessageAsyncDeleteChannelTextMessageAsyncEditDirectTextMessageAsyncDeleteDirectTextMessageAsyncGetChannelTextMessageHistoryAsyncGetDirectTextMessageHistoryAsyncLoggedInChannelJoined| Call | Success Event | Failure / Counterpart |
|---|---|---|
| | |
| | |
| — (any joined channel) | | |
| | — |
| | — |
OnDestroyOnDisableVivoxService.InstanceParticipantMuteStateChangedParticipantSpeechDetectedParticipantAudioEnergyChangedVivoxParticipantParticipantAddedToChannelVivoxService.InstanceAuthenticationService.Instance.SignInAnonymouslyAsync()using Unity.Services.Vivox;UnityServices.InitializeAsyncAuthenticationService.Instance.SignInAnonymouslyAsyncVivoxService.Instance.InitializeAsyncVivoxService.Instance.LoginAsyncClient.InstanceAccountIdChannelIdILoginSessionIChannelSessionVivoxService.InstanceOnDestroyawaitChannelJoinedSendDirectTextMessageAsyncSendDirectedTextMessageAsyncDirectedMessageReceivedRECORD_AUDIONSMicrophoneUsageDescriptionSECRETAPP_ID