docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class VivoxObserver

    A helper class for subscribing to IVivoxService events without needing to manage service initialization state.

    Inheritance
    object
    VivoxObserver
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Services.Vivox
    Assembly: Unity.Services.Vivox.dll
    Syntax
    public sealed class VivoxObserver : IDisposable
    Remarks

    VivoxObserver can be constructed at any time — even before Unity.Services.Core.UnityServices.InitializeAsync() has completed — and will automatically subscribe to the underlying IVivoxService once it becomes available.

    Use VivoxObserverType flags to scope subscriptions to only the events your system cares about. Combine flags with the bitwise OR operator: new VivoxObserver(VivoxObserverType.Login | VivoxObserverType.Channel) Use All to subscribe to all events.

    Always call Dispose() when done to unsubscribe from all events.

    Events are not emitted retroactively. If the service is already initialized or the user is already logged in when the observer is constructed, use IsServiceInitialized and IsLoggedIn to check current state rather than relying solely on ServiceInitialized or LoggedIn.

    Constructors

    VivoxObserver(VivoxObserverType, string)

    Creates a new VivoxObserver that subscribes to the specified observerType events, optionally filtered to a single channel. Uses Unity.Services.Core.UnityServices.Instance as the registry.

    Declaration
    public VivoxObserver(VivoxObserverType observerType, string targetChannelName = null)
    Parameters
    Type Name Description
    VivoxObserverType observerType

    A combination of VivoxObserverType flags specifying which events to subscribe to.

    string targetChannelName

    Optional channel name to filter channel and participant events to a single channel.

    VivoxObserver(VivoxObserverType, string, IUnityServices)

    Creates a new VivoxObserver that subscribes to the specified observerType events, optionally filtered to a single channel.

    Declaration
    public VivoxObserver(VivoxObserverType observerType, string targetChannelName, IUnityServices registry)
    Parameters
    Type Name Description
    VivoxObserverType observerType

    A combination of VivoxObserverType flags specifying which events to subscribe to.

    string targetChannelName

    Optional channel name to filter channel and participant events to a single channel.

    IUnityServices registry

    Optional custom Unity.Services.Core.IUnityServices registry. Defaults to Unity.Services.Core.UnityServices.Instance. Pass the result of Unity.Services.Core.UnityServices.CreateServices() here when using multiple service instances.

    Fields

    ObserverType

    The combination of VivoxObserverType flags this observer was created with.

    Declaration
    public readonly VivoxObserverType ObserverType
    Field Value
    Type Description
    VivoxObserverType

    TargetChannelName

    The target channel name if this observer is filtering events for a specific channel.

    Declaration
    public readonly string TargetChannelName
    Field Value
    Type Description
    string

    Properties

    IsInTargetChannel

    Returns true if the user is in the target channel (if specified). Defaults to false if a target channel was not specified.

    Declaration
    public bool IsInTargetChannel { get; }
    Property Value
    Type Description
    bool

    IsLoggedIn

    Returns true if the user is currently logged into Vivox.

    Declaration
    public bool IsLoggedIn { get; }
    Property Value
    Type Description
    bool

    IsServiceInitialized

    Returns true if the Vivox service is initialized and ready.

    Declaration
    public bool IsServiceInitialized { get; }
    Property Value
    Type Description
    bool

    VivoxService

    Returns the current Vivox service instance if available.

    Declaration
    public IVivoxService VivoxService { get; }
    Property Value
    Type Description
    IVivoxService

    Methods

    Dispose()

    Cleans up all currently registered events and disposes of the observer.

    Declaration
    public void Dispose()

    Events

    AvailableInputDevicesChanged

    This event is called when the list of available input devices changes. Requires AudioDevices.

    Declaration
    public event Action AvailableInputDevicesChanged
    Event Type
    Type Description
    Action

    AvailableOutputDevicesChanged

    This event is called when the list of available output devices changes. Requires AudioDevices.

    Declaration
    public event Action AvailableOutputDevicesChanged
    Event Type
    Type Description
    Action

    ChannelJoined

    This event is called when a channel is joined successfully. Requires Channel. Filtered by TargetChannelName if specified.

    Declaration
    public event Action<string> ChannelJoined
    Event Type
    Type Description
    Action<string>

    ChannelLeft

    This event is called when a channel is left. Requires Channel. Filtered by TargetChannelName if specified.

    Declaration
    public event Action<string> ChannelLeft
    Event Type
    Type Description
    Action<string>

    ChannelMessageDeleted

    This event is called when a channel text message is deleted. Requires ChannelMessages. Filtered by TargetChannelName if specified.

    Declaration
    public event Action<VivoxMessage> ChannelMessageDeleted
    Event Type
    Type Description
    Action<VivoxMessage>

    ChannelMessageEdited

    This event is called when a channel text message is edited. Requires ChannelMessages. Filtered by TargetChannelName if specified.

    Declaration
    public event Action<VivoxMessage> ChannelMessageEdited
    Event Type
    Type Description
    Action<VivoxMessage>

    ChannelMessageReceived

    This event is called when a channel text message is received. Requires ChannelMessages. Filtered by TargetChannelName if specified.

    Declaration
    public event Action<VivoxMessage> ChannelMessageReceived
    Event Type
    Type Description
    Action<VivoxMessage>

    DirectMessageDeleted

    This event is called when a direct message is deleted. Requires DirectMessages.

    Declaration
    public event Action<VivoxMessage> DirectMessageDeleted
    Event Type
    Type Description
    Action<VivoxMessage>

    DirectMessageEdited

    This event is called when a direct message is edited. Requires DirectMessages.

    Declaration
    public event Action<VivoxMessage> DirectMessageEdited
    Event Type
    Type Description
    Action<VivoxMessage>

    DirectMessageReceived

    This event is called when a direct message is received. Requires DirectMessages.

    Declaration
    public event Action<VivoxMessage> DirectMessageReceived
    Event Type
    Type Description
    Action<VivoxMessage>

    EffectiveInputDeviceChanged

    This event is called when the effective input device changes. Requires AudioDevices.

    Declaration
    public event Action EffectiveInputDeviceChanged
    Event Type
    Type Description
    Action

    EffectiveOutputDeviceChanged

    This event is called when the effective output device changes. Requires AudioDevices.

    Declaration
    public event Action EffectiveOutputDeviceChanged
    Event Type
    Type Description
    Action

    LoggedIn

    This event is called when a user successfully logs into Vivox. Requires Login.

    Declaration
    public event Action LoggedIn
    Event Type
    Type Description
    Action

    LoggedOut

    This event is called when a user logs out of Vivox. Requires Login.

    Declaration
    public event Action LoggedOut
    Event Type
    Type Description
    Action

    ParticipantJoined

    This event is called when a participant joins a channel. Requires Channel. Filtered by TargetChannelName if specified.

    Declaration
    public event Action<VivoxParticipant> ParticipantJoined
    Event Type
    Type Description
    Action<VivoxParticipant>

    ParticipantLeft

    This event is called when a participant leaves a channel. Requires Channel. Filtered by TargetChannelName if specified.

    Declaration
    public event Action<VivoxParticipant> ParticipantLeft
    Event Type
    Type Description
    Action<VivoxParticipant>

    ServiceInitializationFailed

    This event is called when the Vivox service fails to initialize.

    Declaration
    public event Action<Exception> ServiceInitializationFailed
    Event Type
    Type Description
    Action<Exception>

    ServiceInitialized

    This event is called when the Vivox service is successfully initialized.

    Declaration
    public event Action ServiceInitialized
    Event Type
    Type Description
    Action

    Implements

    IDisposable
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)