I’ve gotten the basic unet setup to work with the NetworkManager and NetworkManagerHUD. Now I need some help figuring out how to create a script that will search for rooms with empty slots. If it finds one, it should join it. If not, create a new match. How can I do this? Thanks in advance.
Using Unitys matchmaker?
Using Unity’s HLAPI as described in the manuel. I want it to find a game when I press a button.
Yes, you are using Unitys High Level API for Networking? But what matchmaker are you using? Unitys? If so, I would look into retrieving a list of matches. Generate a random number between 0 and the length. And then join the match with the index of your random number
Yes I am using Unity’s matchmaker. This sounds like a solution that could work. What exactly would the script look like? I don’t have a lot of experience with C# yet…
MatchListClass[] matches = GetMatches();
int index = Random.Range(0, matches.Length);
NetworkManager.singleton.StartClient(matches[index]);
Something like that.
After looking into this, it didn’t work. I tried tweaking some things to fix errors to no avail. I think it could work if I used NetworkMatch.JoinMatch(); but had some way to set a variable for the unetId. The only problem is, I can’t figure out how to get the unetId of a random game that is not full.
The code I provided is not functional. I was just showing how it would be done. I don’t know the exact class names for the Matchmaker
hi, @mischa2k @Tornadoally @tomweiland @TwoTen @PartyBoat I’m new in multiplayer game with mirror networking and I’m still learning. I want one help from you guys, how I join random room and if there is no room available then create its own room. is there any way to do that. if you have any solution with the script please provide.
Like, I’m making a simple board game and in first scene there will be one button says Play Button. Using this play button player will find random room and if room available then join else create its own room.
please give a script if you have any.
Thanks in advance.