How can i protect my timer in my offline game against changing time on phone?
That’s very hard to do, if not impossible, unless you require that your game has a server connection.
In fact, I’m pretty sure it’s impossible.
One thing to try is make it extremely difficult by using time since the device booted as your deltaTime, and make it part of your anti-cheating measures. You can still cheat by rebooting the device, or at the very least, cause odd things to happen.
you could also lock/punish players when they revert the time, which they eventually will do. I have made some games that included offline mechanics, but decided against any measures vs cheaters. I was worried that it might punish some non-cheaters, and if people want to cheat, it’s up to them. Might be different when there is money/multiplayer involved.