My networked single PC / multiple GearVR project is up and running. However, as part of the use case for the system, we need to be able to take the headsets on and off during the experience, often leaving breaks of up to 20 minutes.
The problem is that when the headset is taken off the app goes into some sort of pause mode. This will cause the host to report an error after a short while:
ServerDisconnected due to error: Timeout
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
After this error has occurred the system no longer functions, as the connection between the host and client is broken. So, what I need is to find a way to extend the network timeout to 20 minutes. I have scoured the docs for a way to control this, but have found nothing. I have tried adjusting the timeout values in Network Manager → Advanced Configuration, but with no success.
The other option is to somehow re-initialise the network when the timeout occurs, but since my system first uses network discovery to find the host IP address before switching to regular UNET operation, this seems to be a very long way round - I’d much prefer a way to either disable the network timeout or to at least extend it to 20 minutes.
+1 @TwoTen , if you do not use relay, you can implement something like:
Client which is going to suspend: “I’m going to suspend”
Server: “Suspend confirmed”
Client - disconnects…
@aabramychev - I have made further tests and am finding the timeout is even shorter if I don’t use the GearVR. The behaviour is identical to what is described here (although I’m not using matchmaker):
With your proposed solution, where would I catch the ‘I’m going to suspend’ event?
Alternatively, I’m thinking about catching the client disconnect event and attempting to reconnect, but so far I can’t seem to capture the event, despite overriding the following on my NetworkManager:
OnStopClient, OnClientDisconnect, OnServerDisconnect, OnClientError and OnServerError
and implementing the following, also on my NetworkManager:
OnApplicationFocus, OnApplicationPause, OnDisconnectedFromServer and OnPlayerDisconnected
I’m guessing that the fact I can’t seem to capture any event that signals the loss of connection means that either the UNET system is buggy, or I’m missing something quite fundamental…