Hello there!
In Vivox there is a MonoBehaviour (internal) called VxUnityInterop which calls Client.Cleanup() (eventually disconnecting the client) inside OnApplicationQuit() when user presses Alt+F4.
But in our game when the user presses Alt+F4 we set Application.wantsToQuit to false and instead show a modal with confirmation, so we dont want to immediately end the communication. An alternative would be to reconnect the user if the game actually doesnt quit, but thats not very practical.
Is there any way to ignore this routine?
Thank you.
1 Like
Hey dougmolina!
There is currently no way to stop this – the SDK will always try to clean itself up when the app is quitting – but you raise a reasonable use-case!
We can certainly consider making this a configurable setting in the SDK which would leave cleanup to the developer.
Alternatively, we can test how our logic fares in a callback after OnApplicationQuit
, such as OnDestroy
.
Let me know if you have any thoughts on how we could adjust to help with cases like yours!
If your application is in dire need of this change, you can modify the package yourself. This will make it more challenging to upgrade and you’d need to reapply your changes each time you do. Still, this is a path forward if our OnApplicationQuit
behavior is a blocker for you.
Thank you for the quick response.
Since we needed this change I ended up modifying the package.
All I did was replace OnApplicationQuit function in VxUnityInterop with a subscription to Application.quitting and it seems to be working.
Let me know if this should be enough or if there’s anything we’re missing.
1 Like
Great, I’m glad you found a solution!
The solution sounds solid~
If we find that binding to Application.quitting
makes sense and our testing shows it has few/no drawbacks, then you’ll likely see this adjustment in an upcoming release.
Thanks again for raising this!
1 Like