Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    398
    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