Search Unity

UNET Network Discovery Hold id out of bound id {-1} max id should be greater {0} and less than {2}

Discussion in 'UNet' started by nicopetus, Oct 1, 2019.

  1. nicopetus

    nicopetus

    Joined:
    Jan 20, 2019
    Posts:
    1
    Hello, I am currently working on a VR Game using UNET. I created a custom network discovery inheriting network discovery. And once the game is launched on the master when I connect with a client, I recover this error : "UNET Network Discovery Hold id out of bound id {-1} max id should be greater {0} and less than {2}". This prevents the update of the position of the players on the server.

    The following is my custom network discovery :

    Code (CSharp):
    1. using
    2. UnityEngine;
    3. using UnityEngine.Networking;
    4. using System.Collections;
    5.  
    6. public class CustomNetworkDiscovery : NetworkDiscovery {
    7.  
    8.     public delegate void BroadcastEvent(string fromAddress, string data);
    9.  
    10.     public event BroadcastEvent OnReceivedNetworkBroadcast = delegate { };
    11.  
    12.     override public void OnReceivedBroadcast(string fromAddress, string data)
    13.     {
    14.         Debug.Log("From addr " + fromAddress.ToString());
    15.         Debug.Log("Data is " + data.ToString());
    16.         Debug.Log("host id " + this.hostId);
    17.      
    18.         OnReceivedNetworkBroadcast(fromAddress, data);
    19.     }
    20.  
    21. }
    22.  
     
    Last edited: Oct 3, 2019
  2. wechat_os_Qy01jDJT3Hagly-Ut_iDjBNTM

    wechat_os_Qy01jDJT3Hagly-Ut_iDjBNTM

    Joined:
    Sep 11, 2020
    Posts:
    1
    Hello, I also encountered the same problem, how do you solve this bug later