void Update(){
print(audioSource.time);
}
public static float lastAudioPlayTime;
void OnDestroy(){
print(audioSource.time);
lastAudioPlayTime = audioSource.time;
}
from the “Update” values will be logged as 0.1, 1, 2, 3 …
but from the OnDestroy it just Logs 0.
why? and how to get audioSource.time from “OnDestroy”?
Hello! I have an almost similar situation. But I’m trying to get Time.time. I noticed that in OnApplicationQuit() and OnApplicationPause it works fine. But in OnDestroy when app close Log 0. Have you found an explanation for this?
Surely its been destroyed.
I know the docs say
“This function is called when the MonoBehaviour will be destroyed.” “WILL BE” but I think its already destroyed.
Seems firing out the information to something that is not being destroyed may help you.