- Home /
How to disable game elements for a fixed duration then re-enable them automatically, even if game is reopened
A bit of a newbie question here.
I would like to pause the game for a while then continue it automatically. Sort of like when building games ask players to come back once the building had been built; which may take a couple of minutes up to an hour or more. Most likely, the players would close the game and come back then.
I tried to use a Coroutine, but when I close the game and reopen it before the chosen duration, the Coroutine had been reset and the elements I wanted paused, had been re-enabled.
Thank you!
Answer by surfuay · Apr 12, 2019 at 01:49 AM
what you're trying to do is access a static timer controller, basically a server, so that when time is equal to time plus 1 hour (or how ever long) it completes
Here's the best tutorial i've found for implementing a time based concept, he uses it for rewards but the base is the same for what you're doing. You'll just apply it to your object for a specific task rather than a tournament or a daily reward etc
http://leatonm.net/unity-tutorial/unity3d-internet-time-and-date-guide/
Your answer
Follow this Question
Related Questions
How do I pause a method? 1 Answer
Pausing the game after player object gets destroyed 1 Answer
Game won't unpause after pausing 1 Answer
coroutine help 2 Answers
Loop Coroutine For A Demo Mode 1 Answer