Minimizing mobile game causes desync issues

If a user is playing a multiplayer match on mobile and decides to minimize the game or place it in the background, either by accessing the home screen, checking a text message, or browsing other open apps the game will become completely desynced.

This means:

  • Any new game objects spawned by the server will not be created on the client.
  • No Rpcs will be triggered.
  • All Synvars will become “back logged” or not updated (I have a bunch of syncvar queues so this one maybe on my end).

Once they have chosen to set the game as active again, the user will receive all new data correctly. But will never “catch up” to the missing data. Any data that was sent during the minimize time is now lost. Including spawn game objects.

Is there a standard way to deal with this within Unity networking and mobile apps? Run in background? Global re-sync on active?

Looks like this is most likely my fault.

Disabling “Run in Background” in the network manager and clearing any queues that are relying on synvars that are overly large has solved this. I’ll have to go through and verify this for everything but it appears to be working much better than it was.

Anyone know the logic behind re-focusing on mobile? I’m assuming / hoping at this point it’s similar to on player join where all states and variables are acquired.