Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Unet error code : unity host id out of bound id -1 max id should be greater 0 and less than 2

$
0
0
Tried to run on 2018.2.0f2 and 2017.2.0f3 That's now 3 days I'm trying to get rid of this error. I've tried to allow unity in my firewalls, uninstall and install back again unity, to see if i've modified something wrong. But I can't even see what the issue is. Here is the complete error : ---------- unity host id out of bound id {-1} max id should be greater {0} and less than {2} UnityEngine.Networking.NetworkDiscovery:Update() ---------- and here is the code I us for the NetworkManager and the NetworkDiscovery : NetworkManager : public bool runAsServer = true; private CustomNetworkDiscovery netDiscovery; void Start () { netDiscovery = GetComponent(); netDiscovery.Initialize(); if (runAsServer) { SetupServer(); } else { SetupClient(); } } void netDiscovery_OnReceivedNetworkBroadcast(string fromAddress, string data) { Debug.Log("Received fromAddress:" + fromAddress); Debug.Log("Received data:" + data); networkAddress = fromAddress; StartClient(); netDiscovery.StopBroadcast(); } void SetupServer(){ networkAddress = "localhost"; StartHost(); netDiscovery.StartAsServer(); } void SetupClient(){ netDiscovery.OnReceivedNetworkBroadcast += netDiscovery_OnReceivedNetworkBroadcast; netDiscovery.StartAsClient(); } override public void OnClientDisconnect(NetworkConnection conn) { base.OnClientConnect(conn); StopClient(); enabled = false; netDiscovery.enabled = false; Invoke("ProcessDisconnect", 0.5f); } void ProcessDisconnect() { enabled = true; netDiscovery.enabled = true; netDiscovery.Initialize(); netDiscovery.StartAsClient(); } NetworkDiscovery : public delegate void BroadcastEvent(string fromAddress, string data); public event BroadcastEvent OnReceivedNetworkBroadcast = delegate { }; override public void OnReceivedBroadcast(string fromAddress, string data) { OnReceivedNetworkBroadcast(fromAddress, data); }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>