What's the best way to make one-time-only collectible items?

I have a fairly free-roaming game in which the player can move between scenes as they wish. Hidden throughout the game are collectible items which should not be re-loaded when the the player returns to the scene if they have already picked them up.

My player character is currently set to not destroy on scene load whereas all the other content of the levels resets on load.

What's the best way to set up these collectibles so they never reappear after they have been collected?

You could make a boolean that gets set to true when the player picks up the object.

then when the scene gets reloaded you check if the Boolean is true, if it is, you destroy the object.

thats how i would do it anyway :)

The simple way to do this is to use boolean variables to control the status of these items. You need a game controller script to store these variables and they will not be affected when you load a new level.

E.g static var pick_up_1:boolean=false;

Once your character pick up the item, call by GameController.pick_up_1=true. (GameController is your script name)

The validations can be done in either ways (depends on your implementation):

1 Check the variable in level initialing script, if true, then do not instantiate the item object in level


2 Do the checking in item pick-up script. If true, then item is not click-able.