Hi, I'm trying to use Unity's UnityEngine.Networking.PlayerConnection to connect to an iOS device. Connection works fine until I turn the screen off and on. After this, the phone doesn't register a disconnection, but the editor does.
I found another way to register the disconnection, in my case using the ARSessionInterruptedEvent event, but even if it's disconnected first, I can't reconnect to the phone app anymore.
Here's how the flow goes:
- I start the app
- I connect to the app via the console
- I turn off the screen
- I turn on the screen
- After turning on the screen, the editor connection closes
- I try to connect to the phone again, but I get an error saying "Failed to connect to player"
Something is not allowing future connections, but my question is **what**, and how do you fix this, if possible?
Current solution is restarting the app. I also tried reloading the scene when the game was paused and afterwards OnApplicationFocus was called, but this doesn't work. I also tried having Application.runInBackground = true, but this didn't work either.
↧