Destroyed gameobject reappears after scene transitioning

I am trying to make a game and in a scene I destroy an object. After I transition from Scene1 (the current scene) to next scene (Scene2) and then come back to Scene1 then that object is still there. Is there any way that I can destroy that object so it doesn’t come back on transitioning between scenes?

When you reload your scene unless you are persisting the state of it to disk it will start up exactly the same as it did the first time. There are plenty of ways to persist data, from using unities built in methods:



To writing your own or using a database, which you chose depends as much on personal preference as the requirements but the method is pretty similar. Convert your data into some sort of serialised format then put that into a file/ database, then read it back out again on scene loading and set the scene to that data.