- Home /
Unity Ads with cooldown
Hi guys, I'm currently working on a moblie project and was thinking about using rewarded ads. I don't want to have them accessable all the time. I was thinking about a 4 hours cooldown. But I didn't found a solution for a cooldown which does NOT reset at runtime. Any ideas?
Answer by shinevision · Jan 25, 2018 at 12:11 AM
Mmm, Maybe, you could save it every 10 seconds? or more? save the timer variable to player prefs? (https://docs.unity3d.com/ScriptReference/PlayerPrefs.html)
or you could save it somewhere as a txt, or json/whatever format you want. Then when checking, just check the time using one of those systems, for example Player prefs. instead of reading the variable. when the game closes, and reopens, make it set the time variable to the one in the player Prefs (from disk). The problem with this solution tho, is that the counter doesnt count down when the game is closed, so if you have 2 hours left, if you close the app, wait 2 hours, it would still be at 2 hours.. so you might want to somehow make it a background task.
Sorry for the short and rushed answer, have to go in a few minutes.
Goodluck!
Your answer
Follow this Question
Related Questions
How do i get an ad cooldowner? 0 Answers
Export objects to a .3DS file at runtime 1 Answer
Load object at runtime using webplayer 0 Answers
How to edit 3D Text at runtime? 1 Answer