CPU cost with timers vs. OnNewSave?
I'm making a plugin that run a function every 3600 sec (1 hours).
It doesn't need to be precise.
I'm thinking about 2 solutions:
  1. Creating a timer.
  2. Calculate the difference of time at each server save and run the function if the difference is more than 1 hour.
Which is the best performance/which is the most optimised?
Are timers expensive in terms of performance (CPU)?
Timer is not to bad on the cpu you could use timer every and have it check every few min..
Thank you! :)
You could also try FacepunchBehaviour::InvokeRepeating (Not MonoBehaviour), for example there is an always existing instance of InvokeHandler.Instance.
5b6ed4c9ac8e4.jpg misticos
You could also try FacepunchBehaviour::InvokeRepeating (Not MonoBehaviour), for example there is an always existing instance of InvokeHandler.Instance.

Thanks you for this suggestion. I'm new to devlopment, I have to find some documentations to know how to use that :)

There are no documentations for exactly this but you specify time when to run first time (in 10 seconds etc), how often to repeat and the Action to run.
Can you send me an example please?