Switching back and forth between scenes while keeping track of loot.

Okay, fair warning, I am very bad at getting my questions across, and I may just be over thinking this.

So, I have two scenes in my game (1. The ground floor of a house, 2. The upstairs floor of a house). On both floors there are objects that the player can loot for collectables. At the moment my inventory script consists of a DoNotDestoryOnLoad Function so that it persists through the loading of scenes.

My issue is after I have explored the ground floor and collected everything, then moved upstairs, If I was to then return downstairs, all of the collectables have respawned.

Is there a simple way of tracking what objects have been looted that will persist through loading and reloading a scene?

playerInventory Script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class PlayerInventory : MonoBehaviour
{
    public int playerBatteries = 0;

    void Awake()
    {
        DontDestroyOnLoad(this);
    }
}

Loot Script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Loot : MonoBehaviour
{
    //Variables
    public int batteries = 4;
    //public int fuses = 4;
    //public GameObject roomlight;
    //private bool playerIsPresent = false;
   // private bool roomIsLit = false;

    //Script References
    public PlayerInventory playerInventory;
    

    void Awake()
    {
        if (playerInventory == null)
        {
            playerInventory = GameObject.Find("GameManager").GetComponent<PlayerInventory>();
        }
    }

    // Update is called once per frame
    void Update()
    {
        /*
          if (roomlight.activeSelf == true)
        {
            roomIsLit = true;
        }
        else
        {
            roomIsLit = false;
        }
        */
    }
    
    void OnTriggerStay(Collider other)
    {

        if (other.gameObject.tag == "Player" && Input.GetKeyDown(KeyCode.Space))
        {
            if (batteries > 0)
            {
                playerInventory.playerBatteries = playerInventory.playerBatteries + 1;
                Debug.Log("Battery Taken");
                batteries -= 1;
            }
        }


    }
}

SceneSwitcher

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;


public class Level1SM : MonoBehaviour
{
    public Scene currentScene;
    public string currentSceneName;
    public UnityEvent switchLevel;
    // Start is called before the first frame update
    void Start()
    {
        currentScene = SceneManager.GetActiveScene();
        currentSceneName = currentScene.name;
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    void OnTriggerExit(Collider other)
    {
        if(currentSceneName == "Level 1")
        {
                SceneManager.LoadScene(1, LoadSceneMode.Single);
                Debug.Log("Collide");
        }
        else if(currentSceneName == "Level 2")
        {
                SceneManager.LoadScene(0, LoadSceneMode.Single);
                Debug.Log("Collide"); 
        }
        
        
    }
}

This sounds like something that should be stored in a system similar to their inventory. Some stipulations you’ll need to consider to make this work include: every loot item should be uniquely addressable. So you could give each one a unique name or, more scalable-y, you could give each one a unique ID.

Then a “LootTracker” class could store IDs of loot that has been taken. So when you pickup a given loot item, as well as adding it to the player’s inventory, you’d find the LootTracker on the game controller and set that piece of loot as taken. When you enter a scene where Loot exists, each Loot script can check against this to determine whether it’s available or not.

Happy to help with any aspect of the code for this but don’t wanna take away the fun before you need the help!