Immerse SDK
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Events

Connection Status Change

The ImmerseMultiplayer.OnConnectionStatusChanged event is triggered each time the connection status is changed. As this is a static you can subscribe to this event at any time. This is in contrast to similarly named event that can be found in the INetworkClient itself.

See the example below on how to subscribe to this event:

using ImmerseSDK.Multiplayer;
using UnityEngine;

ImmerseMultiplayer.OnConnectionStatusChanged += status =>
{
    Debug.Log("Connection status is: " + status);
};

On Initialize

The ImmerseMultiplayer.OnInitialize event is triggered when a connection attempt occurs. This is useful in the rare occasion that you need reference to the network client being used and need to act before the connection is made.

See the example below on how to subscribe to this event:

using ImmerseSDK.Multiplayer;
using UnityEngine;

ImmerseMultiplayer.OnInitialize += client =>
{
    Debug.Log("Connecting using client of type " + client.GetType());
};

Multiplayer Connection Status Event Trigger

The MultiplayerConnectionStatusEventTrigger component provides easy, serializable access to UnityEvents that are triggered when the connection status changes. One example use of this component is to create indicators that allow users or developers to easily keep track of the connection status without requiring access to the console.

Multiplayer Connection Status Event Trigger component

No event triggers are added when creating a new instance of this component. To track additional connection statuses, press the ‘Add New Event Type’ button at the bottom of the component in the inspector.