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

Bitbucket Bug: InternalAddPlayer playerControllerId higher than expected: 0

Discussion in 'Multiplayer' started by mischa2k, Jan 17, 2016.

  1. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    I attached a simple project without any code. It just uses the NetworkManager(with log level: debug) and the NetworkManager Hud. If you select "Start Host" then it shows a warning:
    ClientScene::InternalAddPlayer: playerControllerId higher than expected: 0

    I was able to find the bug in Bitbucket: https://bitbucket.org/Unity-Technol...c242a89b0b53074/Runtime/ClientScene.cs?at=5.2

    The code does an if check and a while loop, both using:
    playerControllerId >= s_LocalPlayers.Count
    Which is always true because even for the first player, 0 is always >= s_LocalPlayers.Count. Hence it always shows that warning. Everything still works fine though, I just wanted to make a post because it seemed like a pointless warning which confused me for a while.

    [Unity 5.3.1f1 Linux Build]

    Greetings
     

    Attached Files:

    Last edited: Jan 18, 2016
  2. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,116
    Which version are you using?
    in 5.3f1 I don't get this, however if I don't send a AddPlayer message from client (when not using NetworkManager) then I get this. if it is in the patch of 2 days ago it's a regression.
     
  3. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    5.3.1f1. I also noticed it in a custom NetworkManager first, where I didn't use ClientScene.AddPlayer.
     
  4. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,116
    Well in 5.3.1f1 if you use ClientScene.AddPlayer and just have an empty callback in server NetworkServer.RegisterHandler(MsgType.AddPlayer,x=>{}); then it will work as far as my experience with it tells. Then in server I just use the same playerControllerID in NetworkServer.AddPlayerForConnection