Click or drag to resize

StrixNetworkDestroy Method

Closes the connections to both master and room servers if any of them were open and destroys StrixNetworkBehaviour gameObject.

Namespace:  SoftGear.Strix.Unity.Runtime
Assembly:  StrixUnityRuntime (in StrixUnityRuntime.dll) Version: 1.5.0
Syntax
C#
public void Destroy()
Remarks
After calling this method isInitialized returns .
Examples
Note: Make sure to change the placeholder values of applicationId and host to the real ones that can be found on the Strix Cloud application information tab.
using SoftGear.Strix.Unity.Runtime;
using UnityEngine;

public class StrixConnectAndDestroyExample : MonoBehaviour
{
    void Start()
    {
        var strixNetwork = StrixNetwork.instance;

        strixNetwork.applicationId = "00000000-0000-0000-0000-000000000000";
        strixNetwork.ConnectMasterServer(
            host: "0123456789abcdef01234567.game.strixcloud.net",
            port: 9122,
            connectEventHandler: _ => Debug.Log("Connection established."),
            errorEventHandler: args => Debug.Log("Connection failed. " + args.cause?.Message));

        Debug.Log("Connecting to the master server...");
    }

    void OnDestroy()
    {
        StrixNetwork.instance.Destroy();
    }
}
See Also