I am making a game that involves players having an account on a website that keeps track of their credits, which can be used to purchase items in the game. I want to know How to go about this as far as how often the game checks the database to see if the player really does have the items that the webplayer thinks they have. Should I just download the database variables at the start of the game? Or at the beginning of each level? I would like some advice on this please.
Not really Unity-specific, but you have to always check the server. Rule of thumb is: the client is ALWAYS lying. Only the server is telling the truth. If the client says it has 800 credits, that is a lie. Ask the server for the truth.
You should ask the server every time that a transaction is trying to be made, make sure to verify the amount of credits the client says he has. If you don’t… Well tell me where I can play your game and I will have infinite credits in 2 minutes. :3