unity游戏防修改时间作弊源码(防止单机手游修改本地时间作弊)
Time-cheat prevention
(unity 2020 android 10亲测可用)
Mobile (iOS, Android) native plugin to prevent cheating by changing phone time in settings. Does not require server and internet connection - works completely offline!
Many mobile games use timer mechanics: restoring lives, delivering upgrades, training units, breeding monsters, etc. But it is very easy to cheat just by changing device time. (OK, sometimes you must turn off internet connection first)
Now it is possible to make reliable timers even without server and internet connection. This plugin uses internal low-level API to retrieve time data that is agnostic to local device time changes.
Package contains:
1) iOS native plugin
2) Android native plugin
3) C# wrapper class with method to return current unbiased time
4) Optional sc ript that uses ntp pool when connected to network. This feature requires .NET sockets (Unity Pro on mobile)
5) Sample project (C#). YouTube demo:
1