I’m setting up a shop for my game and need to use a buy button in front of the selection button but i don’t know how to permanently disable the buy button after they purchase the skin i know its possible to disable the button but after i leave the scene or end the game it will just simply come back is there anyway to fix this any help is appreciated!
Is there any body that knows anything about this?
More information would be helpful.
Without seeing how your code is set up and what exactly is happening I can suggest a couple of approaches.
The first and easiest, but least efficient and prone to tampering, method is to use PlayerPrefs to set a key for the item and assign a value for when it’s purchased. Then reference that value at initialization to set the state of the buy button.
Another more in-depth way to handle it would be to create a serializable class with the necessary information for the items in the shop that you store in a list in a binary-formatted saved file, which you then load the values of at initialization.
I assume you have some form of persistence already in place as you’re letting them buy what sounds like permanent items. It’s hard to give advice without knowing how it is that you’re handling things like that. It might be a simple addition to a pre-existing system in your game.
There is no way to edit your game scene at run time in a way that will still remain after the app finishes running. This prevents users from destroying their game scene through code.
If you need some sort or persistence then you are going to have to save this information and apply the state you want to display when the game starts again. You can either save it as a player pref or remotely in a database.