Hey everyone! I’m having trouble with how to script a time created in the first scene to appear in the second scene. I can switch scenes just fine, and the timer is working in the first scene, but I can’t seem to find a tutorial that helps with my problem. If anyone has any idea how to do this, please let me know!
A few ways, have it attached to an object with DontDestroyOnLoad, or make the timer function static, so it’s not bound to an object and will persist across scenes. This is also a way to manage variables like “score” which need to persist.
I assume this is a timer that is displayed for the user? Or is it something to tell if like the user beat the game in X time kinda thing?
DontDestroyOnLoad might work either way. Static timer could also work. You could also just record the time to data that is updated on save or on scene exit.
Thanks so much both of you! I used DontDestroyOnLoad and it ended up working!
1 Like