Wait exactly 24 hours
What is the code needed to have a script do something after exactly 24 hours?
Answer by Addyarb · Sep 08, 2015 at 05:12 AM
So the most simplistic way would be to do something like this:
void Start(){
InvokeRepeating("ThingToDoOnceADay",0,86400);
}
void ThingToDoOnceADay(){
Debug.Log("It's Been 1 Day");
}
But you're going to lose track of your time if you exit the application.
So you could either mark the time on Application.Quit(); to continue your 24 hours later, or if you want it to use real-life time you can use this
I need real time and the code you linked isn't compatible with unity.
@filterpilot - The code is compatible. It is expected for anyone working with Unity to know enough of their language of choice to apply the necessary wrappers (class defs, etc.); partial code is often posted and for cases like this should be all that's needed. The "Learn" button at the top has resources for basic scripting tutorials if you are just getting started.
In addition, he linked the info to use real-time but keep in $$anonymous$$d if the app is not running at your 'exactly 24 hours' then nothing will work.
Your answer
![](https://koobas.hobune.stream/wayback/20220612032834im_/https://answers.unity.com/themes/thub/images/avi.jpg)