Click or drag to resize

StrixNetworkDeleteRoom Method

Deletes a match room.

Namespace:  SoftGear.Strix.Unity.Runtime
Assembly:  StrixUnityRuntime (in StrixUnityRuntime.dll) Version: 1.5.0
Syntax
C#
public void DeleteRoom(
	long roomId,
	RoomDeleteEventHandler handler,
	FailureEventHandler failureHandler,
	RequestConfig config = null
)

Parameters

roomId
Type: SystemInt64
ID of the room to be deleted.
handler
Type: SoftGear.Strix.Unity.Runtime.EventRoomDeleteEventHandler
This callback is called when destroying a room has completed successfully.
failureHandler
Type: SoftGear.Strix.Unity.Runtime.EventFailureEventHandler
This callback is invoked in case of a failure.
config (Optional)
Type: SoftGear.Strix.Client.Core.RequestRequestConfig
If not null, used to configure the request timeout. Default timeout is 30 seconds. See RequestConfig for more details.
Remarks
To delete a room you must be the room's owner.

Possible exception types in FailureEventArgs's cause:
ErrorCodeException Strix error which can be further separated by an error code:
ConnectionErrorFailed to send the request because of a connection error.
RequestTimeoutServer did not respond within the specified timeout interval.
ModelNotFoundThe room with roomId is not found.
LockTimeout
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 StrixDeleteRoomExample : MonoBehaviour
{
    void Start()
    {
        var strixNetwork = StrixNetwork.instance;

        strixNetwork.applicationId = "00000000-0000-0000-0000-000000000000";
        strixNetwork.ConnectMasterServer(
            host: "0123456789abcdef01234567.game.strixcloud.net",
            connectEventHandler: _ => {
                Debug.Log("Connection established.");

                strixNetwork.CreateRoom(
                    new Dictionary<string, object> {
                        { "name", "My Game Room" },
                        { "capacity", 20 }
                    },
                    playerName: "My Player Name",
                    handler: createRoomResult => {
                        Debug.Log("Room created.");

                        strixNetwork.DeleteRoom(
                            roomId: strixNetwork.room.GetPrimaryKey(),
                            handler: deleteRoomResult => Debug.Log("Room deleted: " + (strixNetwork.room == null)),
                            failureHandler: deleteRoomError => Debug.LogError("Could not delete room. Reason: " + deleteRoomError.cause)
                        );
                    },
                    failureHandler: createRoomError => Debug.LogError("Could not create room. Reason: " + createRoomError.cause)
                );
            },
            errorEventHandler: connectError => Debug.LogError("Connection failed. Reason: " + connectError.cause)
        );
    }
}
See Also