Global custom timer

I’m thinking about creating game timer similar to minecraft ticks. Like every 20-50ms there will be a game tick. And all game stuff will depend on these game ticks.

So, it will be a singleton or static class with simple timer and on every tick it will fire event notyfing all listeners that time unit(tick) passed.

  1. Is this implementation ok or something better alerady exist?
  2. What are possible downsides to this system?

There are “ticks” already with Time.fixedDeltaTime (Project Settings->Time->Fixed Timestep), FixedUpdate() runs every time step. So you don’t need to fire events and have listeners, it’s already there for all MonoBehaviour objects.

The downside is that it is not run at true time intervals like frame rate, meaning a bunch of ticks can run back to back - to match up with the frame rate. I would not recommend setting it at 50 ms, rather set it to 10 ms, and do your stuff every 5 ticks.