Home > Enterprise >  Firebase unity mobile game set firestore data to offline while player offline
Firebase unity mobile game set firestore data to offline while player offline

Time:10-20

As title, I am using unity for building a mobile game and going to mark a player as offline, so other players will know that(show offline icon beside the player's name). I've tried when the Application is not focusing, update firestore doc's field to offline, but in some situations, it not working( ex. application crash, out of battery, or others). Is any way to make sure when a player left the game, mark this player is offline correctly.

Many thanks

CodePudding user response:

You can update a specific path in the Database with the current timestamp. So, on other player side, you have to do a little calculation to find out if last timestamp already exceeded a threshold (1 minute) from the current timestamp.

  • Related