What is the best type of c# timer to use with a Unity game that uses many timers simultaneously?
- by Kyle Seidlitz
I am developing a stand-alone 3d game in Unity that will have anywhere from 1 to 200 timers running simultaneously. There will be a GameObject containing 1 timer. 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.
Each object is a prefab, with all the necessary materials included. An attached script will handle the timer and all the necessary code to change the materials and make any sound effects. Once the timer is expired, the user will then click on the object again, and the object will be destroyed, and the user's inventory will be adjusted.
If the user wants to save or end the game before all the timers are done, the start value 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 be checked to see if they have expired, where the object's materials will be changed 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?