What is the best type of c# timer to use with an Unity game that uses many timers simultaneously?

Posted by Kyle Seidlitz on Game Development See other posts from Game Development or by Kyle Seidlitz
Published on 2014-08-25T02:20:52Z Indexed on 2014/08/25 4:33 UTC
Read the original article Hit count: 307

Filed under:
|

I am developing a stand-alone 3d game in Unity that will have anywhere from 1 to 200 timers running simultaneously. For this game timer durations will range from 5 minutes to 4 days. There will not be any countdown displays or any UI for the timers. An object will be selected, a menu choice will then be selected, and the timer will start. Several events will occur at different intervals during the duration of the timer. The events will be confined to changing the material of the selected object, and calling a 1 second sound effect like a chime or a bell.

If the user wants to save or end the game before all the timers are done, the start of the still running timers is to be saved to an XML file such that when the game is started again, any still running timers will have a calculation done to see if the timer is then done, where the game will change the materials appropriately.

I am still trying to figure out what type of timer to use, and see also if there are any suggestions for saving and calculating times over several days.

What class(es) of timers should I use? Are there any special issues I should look out for in terms of performance?

© Game Development or respective owner

Related posts about c#

Related posts about unity