Updating Room Information

The current owner of the room can also change some of its properties.

void SetRoom(long roomId, RoomProperties roomProperties, RoomSetEventHandler handler, FailureEventHandler failureHandler, RequestConfig config = null)
void SetRoom(long roomId, IDictionary<string, object> roomProperties, RoomSetEventHandler handler, FailureEventHandler failureHandler, RequestConfig config = null)

Code Example

using SoftGear.Strix.Unity.Runtime;
using UnityEngine;

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

        // This is a placeholder value. Change this to your application ID
        // It can be found on the Strix Cloud application information tab: https://www.strixcloud.net/app/applist
        strixNetwork.applicationId = "00000000-0000-0000-0000-000000000000";

        // First we connect to the master server
        strixNetwork.ConnectMasterServer(
            // This is a placeholder value. Change this to your master hostname
            // It can be found on the Strix Cloud application information tab: https://www.strixcloud.net/app/applist
            host: "000000000000000000000000.game.strixcloud.net",
            connectEventHandler: _ => {
                Debug.Log("Connection established.");

                // After we've connected to the master server we can create a room
                strixNetwork.CreateRoom(
                    roomProperties: new RoomProperties {
                        name = "Wildwood",
                        password = "66e3f2nk",                          // This room will be password-protected so clients without the password won't be able to join it
                        capacity = 20                                   // The maximum number of clients the room will hold
                    },
                    memberProperties: new RoomMemberProperties {
                        name = "Artemis"                                // This will be the name of our player
                    },
                    handler: __ => {
                        Debug.Log("Room created. Current capacity: " + strixNetwork.room.GetCapacity());

                        // Now that the room is created let's try to change its capacity
                        strixNetwork.SetRoom(
                            roomId: strixNetwork.roomSession.room.GetPrimaryKey(),   // The ID of the current room
                            roomProperties: new RoomProperties {
                                capacity = 15                                        // Change capacity from 20 to 15
                            },
                            handler: setRoomResult => Debug.Log("Capacity changed. Current capacity: " + strixNetwork.room.GetCapacity()),  // Printing the new capacity
                            failureHandler: setRoomError => Debug.LogError("Search failed. Reason: " + setRoomError.cause)
                        );
                    },
                    failureHandler: createRoomError => Debug.LogError("Could not create room. Reason: " + createRoomError.cause)
                );
            },
            errorEventHandler: connectError => Debug.LogError("Connection failed. Reason: " + connectError.cause)
        );
    }
}

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.