How can I load a new scene without losing context of previous?
I'm making a car game and I want to allow the player to:
Go to a new scene to select a different car (the previous scene should be paused)
Return to the previous scene without losing context, replacing the car with the newly selected car.
I've tried this:
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
public class CarSelect : MonoBehaviour {
public void LoadCarSelectScene() {
SceneManager.LoadScene ("CarSelect", LoadSceneMode.Additive);
}
public void UnLoadCarSelectScene() {
SceneManager.UnloadScene ("CarSelect");
}
}
LoadCarSelectScene
is triggered via a button click.
What I'm seeing is that the next scene is not loaded and I get the following warning: There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene.
This seems like common functionality for many games, but I'm struggling to find out how to do this.
Your answer
Follow this Question
Related Questions
Why isn't my start screen loading? 0 Answers
When I load a scene a second time, some objects don't show up 0 Answers
multiple of same objects from DontDesroyOnLoad 0 Answers
Game crashes after button is clicked to load scene 0 Answers
How do I trigger a function right after a additive scene ends? 0 Answers