Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Unity Multiplayer (Lobby/Matchmaking) Transitioning from Photon. How to list/join rooms?

Discussion in 'Multiplayer' started by carmine, Feb 1, 2016.

  1. carmine


    Jan 4, 2012
    I've built a game before with Photon (it handles lots of players, it's on Steam, blah, blah, blah)

    I'm starting a new game, and I wanted to take the plunge into UNet. I'm trying to get started, but I'm a bit confused. I think maybe I'm looking for something between the HLAPI and the low-level. I'm trying to use Unity's servers here:

    The expectations I'm ... expecting (from my experience with Photon and others):
    1. I connect to a server. Then get some sort of notification/event "OnConnect" when that happens.
    2. I can get a list of "rooms" I think in UNet these care called "lobby" or "matches?"
    3. I can create a room, then get an event/notification "OnRoomJoin" when this happens.

    I created a game object, and made my own class that is derived from "NetworkLobbyManager".
    I tried using this.client to connect to Unity's servers, but that didn't seem to do much, so I tried:


    This seemed to do "something" however, I did not get any sort of response that I was connected to a server or not. (No OnAnything's delegates were called)

    From there, I tried:

    This seemed to work fine, it called my specified delegate that there were 0 matches.

    I then tried:

    This also seemed to work.. BUT, in my call back "OnMatchCreate", if I call

    it calls OnStartClient and OnClientConnect, but then has errors that I don't have the scenes and prefab specified. (I don't want it to do this automatically), I want to do this myself.

    If I don't call base.OnMatchCreate, it seems as though "OnStartClient" and "OnClientConnect" are never called (I'm assuming it's important that they are?)

    - Am I just way off base here and doing this all wrong?
    - Is there a way to know I "connected to the server". Or are all these calls just web calls under the hood and I'm not actually connecting to anything until much later?
    - Is there a way to call base.OnMatchCreate without having it trying to do so much for me.