Search Unity

ClientScene.AddPlayer resulting in 'Unknown message ID' error

Discussion in 'Multiplayer' started by hasseyg, Jun 30, 2015.

  1. hasseyg

    hasseyg

    Joined:
    Nov 16, 2013
    Posts:
    81
    Hi, I have a test Unity networking project where in the menu scene I have implemented the NetworkManager class and have disabled player auto creation. When a server hosts a game using matchmaker and a client then joins that game, the server then changes the scene to the 'Game' scene. Both the server and the client successfully load this scene and the sever instantiates it's prefab and calls NetworkServer.Spawn to show it on the client. Up to this point the code works and both the server and the client can see the server's spawned object, however when I call ClientScene.AddPlayer on the client to send a message to the server to create the client's player, it results in an error on the server and OnServerAddPlayer is not called. The error is :

    Unknown message ID 37 connId:1 UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

    Has anyone else ran into this or a similar issue?

    thanks
     
  2. Necromantic

    Necromantic

    Joined:
    Feb 11, 2013
    Posts:
    116
    This means your Server/Client has not registered to the Event Handler for the message id, therefore it does not recognize the incoming message.
    Use NetworkServer.RegisterHandler.
     
    Last edited: Jul 1, 2015
  3. Shrikky23

    Shrikky23

    Joined:
    Jun 30, 2013
    Posts:
    24
    Dude thanks !
    Unity is dumb, I can send message from the server (LOCALCLIENT) to client.. but I cannot send a message from Client to LOCALCLIENT(server). I need to register on the Local client as NetworkServer.RegisterHandler instead of Client.RegisterHandler.. I thought I was sending the message to the LocalClient in the server..
     
    Suraksha226 likes this.