[Hololens] Connecting using Unity's UNET doesn't work after the first time connecting
I am trying to get Unity's built-in networking set up for Hololens, and I have just a basic UI and script to will either start a host or join a host.
Here is my code:
void Start()
{
netManager = GameObject.Find("Networking").GetComponent<HololensNetworkManager>();
}
public void StartGameServer()
{
netManager.serverBindAddress = ip;
netManager.serverBindToIP = true;
netManager.networkAddress = ip;
netManager.networkPort = port;
netManager.StartHost();
}
public void StartGameClient()
{
netManager.networkAddress = ip;
netManager.networkPort = port;
netManager.StartClient();
}
The HololensNetworkManager component is just an extension of the standard NetworkManager component that I use to override the OnClientConnect and OnServerConnect functions for debugging purposes. The port variable is set to 7777 and the ip variable is hard-coded with the IPv4 address of the Hololens obtained from the device settings.
I can open the app on the Hololens and then run StartGameServer, and then start playing in the editor on my computer and run StartGameClient from there and it works fine once. The OnClientConnect and OnServerConnect functions get hit, and my debugging code runs. However, running this flow again (without changing any code! just fully closing the app on the Hololens/stopping in the editor and re-opening) the OnClientConnect and OnServerConnect on the Hololens do not get hit and my debugging text doesn't show up.
Are there certain behaviors with UWP and Unity's built-in networking that cause this? Any ideas on how I can fix/get around it? I haven't seem to found anyone else running into this issue so I'm not sure what I'm missing.
Your answer
Follow this Question
Related Questions
Photon Networking - How to move all players from game scene to current room scene? 0 Answers
unity NetworkingLobbyManager problem 0 Answers
Using joints with UNet Not Working Correctly 0 Answers
Designing a multiplayer lobby for LAN 1 Answer
Day/Night cycle turns black at night and how to Serialize it rightly? 0 Answers