Help with Network Discovery.

I know that the Network discovery in unity has been deprecated but it is exactly what i need right now.

I have so far got it work properly. A server broadcasts and the client listens to the broadcast. After it finds the broadcast, i connect to the server by using NetworkManager.singleton.StartClient. This works fine as well.

Whenever the client is connected the server spawns him in the scene as well.

Now, my problem is inconsistency. Whenever, i do a StopBroadcast()/ StopClient() or StopServer(), my expectations were that all the network aspects will closed automatically. But, for reason my app runs 4 - 6 times without any problem. Then the client stops discovering the host. To make it work again i have to restart the entire computer or cell phone.

I think it is because i or unity is not shutting the network stuff properly.

Would any of you be able to point me to the right direction?

Reliability has been a problem with Unet’s network discovery. Lots of threads on the topic from general unreliability, to issues or outright incompatibility with specific device models. You could search for many of these older threads, but my memory of them is they are full of complaints without solutions. I’d look for a 3rd party implementation if one exists, as there hasn’t been fixes in this area of Unet for years and none are coming in the future.