GitHub Documentation

Error: Failed to auto-create room [Unity Client]

  • Whenever i try to join room with quick match i get this error

    Error: Failed to auto-create room "table" during join request using options "
    at MatchMaker.create (D:\Colysues Server Unity\Server\node_modules\colyseus\lib\MatchMaker.js:228:19)
    at MatchMaker.<anonymous> (D:\Colysues Server Unity\Server\node_modules\colyseus\lib\MatchMaker.js:114:31)
    at (<anonymous>)
    at fulfilled (D:\Colysues Server Unity\Server\node_modules\colyseus\lib\MatchMaker.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

    although if there is any available room it worked just fine and join that room. problem occurs when there is no room available to join (should not it automatically create a room ?)

    here's server onJoin method

    requestJoin (options, isNew) {
    console.log("request join!", options);
    return (options.create)? (options.create && isNew) : this.clients.length > 0;
    onJoin (client, options) {
    console.log("client joined! ", options);

    Unity client code

    string roomName = "table"
    //for Quick Join
    public void Join()
    room = client.Join(roomName, new Dictionary<string, object>()
    { "create", false}
    //for Creting new room
    public void Create()
    Debug.Log("Let's Crete & join the room!");
    room = client.Join(roomName, new Dictionary<string, object>()
    { "create", true },

  • administrator

    Hi @hardik_sl,

    You may modify the requestJoin method to allow creating the room regardless of the param create is being passed as true or not. I've made this example to demonstrate that clients may have control to create or join into rooms. By omitting the requestJoin method, it will always return true.

  • [SOLVED]
    Thanks @endel but as i am making card game i need to have options for client to choose whether to create a room ( private table ) or join the room ( if there is no room available then auto create room with)


© 2021 Lucid Sight, Inc