Search Unity

How do you populate the networkMessage on connection?

Discussion in 'Multiplayer' started by rob_vld, Jun 23, 2015.

  1. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    Code Typed HLAPI( C# ), Standalone authoritative server, WAN

    - How do you populate the networkMessage to the player connection?

    With:
    NetworkServer.RegisterHandler( MsgType.Connect, OnServerConnect );
    private void OnServerConnect( NetworkMessage networkMessage )
    { }

    For example networkMessage.conn.connectionId is always 1 on multiple connected clients, while the server does increase this figure.
     
    Last edited: Jun 23, 2015
  2. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    I think you can't change internal messages, they get populated automatically. If you want to send more, send your own message.
     
  3. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    I am not sure what you mean by sending more?
    I am talking about the first handshake between the client and the server, where the server assigns an ID to the client... this is not happening...a bug perhaps?
     
  4. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    I think it's normal that the connection on every client has the same ID since the server is the only connection they have. I would have expected 0, though.
     
  5. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    connectionIds are not shared between clients or the server. they are scoped to just the local instance.