If application Start() work, I want to set after real 10 minutes , but I can quit from application or again start application but time have to be pass real 10 minutes continuously. After 10 minutes, I want to show Text; (ANDROİD)
public UnityEngine.UI.Text myText; //Canvas UI text
void Start(){
myText.enabled = false;
}
void Update(){
if(Time.time >= 600f){ //60 seconds times 10
myText.enable = true;
}
}
Not quite sure what you are asking… but several options here…
You can use an ienumerator timer… that waits 10 minutes then runs your code…
but when you switch off device… timer will be gone…
So when you switch off… you could store time left in a playerPrefs value, then read it back into timer when you re-load game… You can detect game close with…
OnApplicationPause or OnApplicationQuit()
Another Option…
You can use System.DateTime to get the current time on your device…
Then add 10 minutes to it…
and save that as a string in playerprefs… and in a variable. as “expiryTime”
then everytime you re-open your app, re-read the playerprefs expiry time back into variable…
You’ll need to Parse the string back into DateTime format
occasionally check if the system.dateTime has expired… then popup your message at the correct time. (or run whatever code you’d like to run)