How do I make fusion join a random room with active players?
How do I make fusion join a random room with active players in it that doesnt have a session name like 693468978-6837-7358793587
Best Answer
-
Hi,
Currently, the session name is a GUID created by the matchmaking system.
But, what you can do it's make your own flow to connect to a session. Like the following:
- Try to connect normally to a random session, but with the
DisableClientSessionCreation
(I may have misspell the naming) attribute ofStartGameArgs
set toTrue
. - Since now the client can't crate a session if none was found, it will throw an exception that no session was found.
- You can now handle the exception and try to start a new game (with clients being able to create a session) with a new session name that you can generate... a 6 digits code for instance.
-----
Isaac Augusto
Photon Fusion Team
0 - Try to connect normally to a random session, but with the
Answers
-
Hey,
You can just left the session field blank on the
StartGameArgs
when starting a game withGameMode.Client
.GameMode.Client
: Will join a random room, if no room was found, throws an exception.GameMode.AutoHostOrJoin
: Will join a random room, if no room was found, It will create one.GameMode.Shared
: Same as AutoHost.-----
Photon Fusion Team
Isaac Augusto
0 -
Hey, thanks for the response! I use shared and do just that for joining a random room but I was wondering if it is possible to have fusion generate a more simple room name when creating a room (if no room was found of course). From what I have seen it seems to generate very long complex session names when no session name is given. Example being something like: 67206702068-684936-6439869
0 -
Hi,
Currently, the session name is a GUID created by the matchmaking system.
But, what you can do it's make your own flow to connect to a session. Like the following:
- Try to connect normally to a random session, but with the
DisableClientSessionCreation
(I may have misspell the naming) attribute ofStartGameArgs
set toTrue
. - Since now the client can't crate a session if none was found, it will throw an exception that no session was found.
- You can now handle the exception and try to start a new game (with clients being able to create a session) with a new session name that you can generate... a 6 digits code for instance.
-----
Isaac Augusto
Photon Fusion Team
0 - Try to connect normally to a random session, but with the
-
Thank you very much for the help! One more question I'm still pretty new to fusion so this may he an obvious question but will fusion also throw an exception if the room has reached max players (set in network project config)? Thanks again for all the help!
0 -
0