How to stop objects you picked up from reappearing when you go to another level and return

I’m very new to Unity, but I would like to create a game in which you go to different scenes (levels) and collect lots of the same item, which is then used to open new stages of the hub world. The concept is inspired by Banjo-Kazooie, where you collect lots of notes to open different stages of Grunty’s Lair. However, I do not intend to make a BK clone; I refer to BK below simply because it’s a well-known reference.

I’ve figured out how to transfer from one scene to another and back, but the problem I’m running into is that when I pick up all my items in Scene 1, then go to Scene 2, and then return to Scene 1, the Scene 1 items have all reappeared. (That means that instead of having to go to all the levels, the player could just switch between scenes, pick up the respawning items, and win the game easily. The BK equivalent would be getting all the notes in Mumbo’s Mountain, leaving, coming back, and then recollecting all the notes so that you have 200.
Note: because my score also resets in between levels, that isn’t necessarily the problem right now–but it will be once I figure out how to preserve my scores.

  1. I’m wondering if there is a way to stop those Scene 1 items from reappearing (similar to how notes collected in Banjo-Tooie never come back). One comment suggests that DontDestroyOnLoad would not help, since the pick-up items would still come back.

  2. One possibility would be to make the pickups specific to each level. For instance, to open Door B in the hub scene, you would need to collect 50 Door B points in Scene A. Door A points, Door C points, Door D points, etc. would do nothing. Once you have 50 Door B points, Door B would be destroyed. You wouldn’t gain anything by picking up 10 Door B points, then leaving/returning, because your Door B point score is automatically reset to 0.
    But again, once I go back from Scene A to the hub scene, I would lose all my Door B points and Door B would be back. But if I could simply preserve my number of Door B points from Scene A to the hub scene, that would work fine.

  3. In Banjo Kazooie, the notes do come back, but if you collect 80 notes in Mumbo’s Mountain, leave, return, collect 75 notes and come back, you would only have 80 notes (not 155). The game only preserves your high score for each level. Would there be a way to program that into my game? That way, recollecting the notes wouldn’t accomplish anything for the player, unless they collect more notes than they did before.

  4. I’m very tempted to only use one big scene and teleport the player from level to level within that scene. If I have 5 or 6 different levels, would that drag the game down if my art stays pretty basic?

THANK YOU in advance for your help!

You have a very simple problem : Persistent data management.

There are many ways to solve this. Store the info about collected objects in :

  • SQL Database (avoid if you only have one type of object to collect, don’t go into this for one sql table only)
  • Files : Simple text / XML / JSON / … (A little bit tricky, but not that much)
  • Scriptable objects : Pretty simple to use
  • PlayerPrefs (avoid for big volume of data)