Tracking which Treasure chests are opened

If I have multiple treasure chests in my game and I want the ones that I have already opened to stay opened so they cannot be opened again when you reenter the scene how would I go about doing this? I have it where there is a bool to check if the chest has been opened or not and while I am on the current scene the chests stay open but as soon as I leave the scene and re-enter they close again and can be re-opened. I tried do not destroy on load and it tracks the chest being opened but it also adds an additional chest which I do not want. Thanks!

Unfortunately, you are going to have to keep track of the data between scene loads. You need to have some sort of global manager that the chests will send their state data too when the scene shutsdown, then the global manager will send the data back in the chests when the scenes load.

You need to have an id for each of the chests that spawn, so they can get the correct data. A simple dictionary should be fine - where the key is the id and the value is the data you are saving. As long as it’s the same session, I believe InstanceID of the object should be fine.