Search Unity

Game quit time and pause time?

Discussion in 'Editor & General Support' started by skcai, Dec 21, 2019.

  1. skcai

    skcai

    Joined:
    Oct 8, 2019
    Posts:
    23
    Hi,I want to make a Hang up function for a mobile game.That could get game items by outlietimes.
    How could I get the game quitTime,pauseTime?
    And the time must be online time ,not local time.
    Need for your help from "Skcai" :)
     
  2. doarp

    doarp

    Joined:
    Sep 24, 2019
    Posts:
    147
    Save the real time in PlayerPrefs.
    You can get that from System.DateTime.Now;
     
  3. skcai

    skcai

    Joined:
    Oct 8, 2019
    Posts:
    23
    Thanks! By the way,If the quit operation executed in back , how to save get the realTime. I mean the application is outline and quit.When should I do Saving operation ?
     
  4. doarp

    doarp

    Joined:
    Sep 24, 2019
    Posts:
    147
    You can save every second, or every 10 seconds or every minute, depending on how important the time resolution is for you.
     
    skcai likes this.
  5. skcai

    skcai

    Joined:
    Oct 8, 2019
    Posts:
    23
    Got it! Thanks so much~:)
     
    doarp likes this.