Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Unity Multiplayer How to properly send message and register for message ?

Discussion in 'Connected Games' started by Paradoks, Sep 16, 2018.

  1. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    421
    Hello,

    I am getting a message like that, and i use the NetworkMessage to send back to sender a message:

    Code (CSharp):
    1.  
    2.  
    3.         protected virtual void OnGameServerRegistered(NetworkMessage netMsg)
    4.         {
    5.             var msg = netMsg.ReadMessage<RegisterGameServerMessage>();
    6.             if (msg != null)
    7.             {
    8.                      var createdRoomId = new RequestSetRoomIdOnGameServer ();
    9.                     createdRoomId.roomId = gameServerId
    10.                     netMsg.conn.Send(MatchmakingNetworkProtocol.RequestSetRoomIdOnGameServer, createdRoomId);      
    11.             }
    12.        }
    13.  
    Then on the other side i do that

    Code (CSharp):
    1.  
    2. NetworkServer.RegisterHandler(MatchmakingNetworkProtocol.RequestSetRoomIdOnGameServer, OnSetGameId);
    3.  
    But nothing reaches this place ...
    What did i miss ?

    Thx