Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Help: Custom NetworkLobbyManager not working

Discussion in 'Multiplayer' started by AllMightyNico, Feb 5, 2016.

  1. AllMightyNico

    AllMightyNico

    Joined:
    Jun 12, 2015
    Posts:
    14
    Hello dear Community,

    I am sorry to bother you once again, but I am getting stuck while creating my own NetworkLobbyManager.
    I derived from NetworkLobbyManager and added some code, to be able to create and join matches via the matchmaker thats included. These functions are triggered from buttons of my custom GUI. With the help of some good advices from our fellow Jeremy in the last days, I was able to grasp the mere concept of the NetworkLobbyManager and the role and usage of the matchmaker that is being contained by it.
    However, I am having trouble with loading the lobby scene, or rather said: I cant figure out how to "inject" my stuff the best way, without losing the functionality of the NetworkLobbyManager. From the documentation, I get that you better not touch the the callback functions but the ones that are beginning with OnLobby.

    I think its best to show you guys on what I am stuck right now:

    Code (CSharp):
    1.  
    2.    public void CreateMatch()
    3.     {
    4.         CreateMatchRequest _createMatchRequest = new CreateMatchRequest();
    5.         _createMatchRequest.name = "New Game";
    6.         _createMatchRequest.password = "";
    7.         _createMatchRequest.size = 2;
    8.         Dictionary<string, long> matchAttributes = new Dictionary<string, long>();
    9.         matchAttributes.Add("mapID", 0);
    10.         matchAttributes.Add("bHasPassword", 0);
    11.         matchMaker.CreateMatch(_createMatchRequest, OnMatchCreate);
    12.     }
    13.  
    14.  
    My idea was to simply hook up on the OnMatchCreate call back with my own CreateMatchRequest and let the NetworkLobbyManager handle the rest. However, when I click the button in my matchlistscene, I only get the messages in the output log, which say that the creation of a match was a success. What is not happening, is that the lobby scene is loaded or that a lobbyPrefab gets created. Can anyone help me out here please?
    What am I missing? Is that the wrong approach? What is the best way of customizing the NetworkLobbyManager and how should I join and create a match, at best?

    BTW: Of course, the matchMaker is already running at that point.
     
    Last edited: Feb 5, 2016
  2. leizzer

    leizzer

    Joined:
    Jun 26, 2013
    Posts:
    39
    Hello,

    I found this to be a good example on hooking and custom network lobby.

    https://www.assetstore.unity3d.com/en/#!/content/41836

    I still didn't do much with hooks but it helped me a lot with my migration from the old networking.

    Sorry I can't help you more, but I know how frustrating it is, so this is 2 cents.

    Also I found these videos useful as well


    Good luck

    Edit: I couldn't remove the embed video... Is a list of videos and it has one for matchmaking