- Home /
Unity how to find load time?
I'd like to find the time between when I press the play button and when the game actually starts. Is there a builtin function or a system function I could use to measure this?
I tried using Unity's builtin time functions to store a start time in Awake() and an end time in the first frame of the game. Then printed endTime - startTime - Time.deltaTime (Time it took to run the first frame). $$anonymous$$y results were co$$anonymous$$g out at about 0.3 seconds when taking the same time with my phone's stopwatch was giving me about 3 seconds.
Answer by tormentoarmagedoom · Jan 30, 2019 at 12:32 PM
Good day.
Some option is configure in unity editor that script "SomeScript" is executed the first. In this script, at Awake(), store the value Time.time in a variable called like "InitialTime"
Then, in the first Update of this script, just do
TimeSpentLoading = Time.time - InitialTime;
Bye!