Hey,
I just wanted to see if there was a way to check how much time has passed in real time? Basically the player buys something, and they're allowed to buy again after 8 real time hours. Would this be possible? Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Presumably they can close/re-open the game in between?
You'd have to use a custom script that records the current system time in seconds, adds 28800 (the number of seconds in 8 hours), and then sets that to a Global Integer Variable.
Create two Global Integer variables named BuyAgainTime and CurrentTime.
Create a new C# script named SetTime.cs and paste in the code below:
Add it to an empty GameObject, make it a prefab and remove from the scene. You can then use Object: Call event Actions to call the two functions OnBuy and UpdateCurrent within it.
It works!! Thanks so much Chris you're awesome