DontDestroyOnLoad on a specific scene

if (Input.GetKey (KeyCode.Z)|| Input.GetKey(KeyCode.X)) {
if (other.gameObject.tag == “Jake”) { Application.LoadLevel(1); }
if (other.gameObject.tag == “talor”) { Application.LoadLevel(1); }
if (other.gameObject.tag == “SceneChanger1”) { Application.LoadLevel(2); DontDestroyOnLoad(gameObject.transform); }
}
How do I make it so when I switch through “talor” from scene 2 to scene 1 it won’t keep the player?

Once you’ve marked an object with DontDestroyOnLoad, you’ll have to destroy it manually or it will continue to exist as long as the game is running.

If you have some sort of singleton pattern, you could easily check certain conditions just before switching levels. If and when the right condition is met, you can destroy the singleton instance.

If you’re not familiar with singletons, you can look up some tutorials online.

Objects with DontDestroyOnLoad, wont be destroyed. however you can enable gameobjects for certain scenes or make them invisible when you dont want them to be used. Then when you are in the right scene you can enable the gameobjects