Closed Lucidarme closed 3 years ago
Thanks @Lucidarme, I wasn't aware you were referring to the unity3d client, there might be an issue parsing metadata there indeed as @tonygiang reported this recently https://github.com/colyseus/colyseus/issues/381, which seems related to what you are experiencing!
Thank you but I've already read that when i was looking for a solution, but it's not the same problem. To me, metadatas works perfectly when the room is created synchronously. I have this problem only when the room is created asynchronously !
Alright, thanks! Gonna check it soon @Lucidarme
Thank you !
Hi @Lucidarme,
I've checked your sources and the problems seems to be because maxClients
is parsed as string when coming from the XML file. Whereas when you set it manually, it is a number.
If you use parseInt(res.room.maxClients || 6)
it works. I think this is more of a type definition issue, as res.room.maxClients
is interpreted as any
Perhaps we should throw an error if this.maxClients
is anything other than Number
Hi @endel
You are right, and it's the same thing for publicName, I had to parse it to string to make it work. Yes an explicit error could be fine, it may save lot of time !
Thank you for your help !
colyseus-issue.zip
As explain on the Discord, there is an issue when a room is created asynchronously. The issue is that in the unity client, the function GetAvailableRooms() returns all the rooms but without metadatas nor any other param like maxClients. I link a .zip which contain a reproduction scenario. I tried with promises
promise().then({ CreateRoom })
, with async/await, and I also tried to set OnCreate async and the result is the same.My aim was to load a configuration file before creating the room, and configure the room from the data loaded.