How can I change completely the scene?
Hello friends, I'm doing a question tipically of a noob. But I'm starting in the programming of games and in Unity3d too. I have to say this is awesome, but I have this problem, I can't change the scene without delete the previous scene and their objects. I have a Trigger in a location of the screen, and an event, the events makes change the scene when the mouse is pressed into the trigger, but when it happends, the scene changes but the colors and objects are mixed with the "current" scene. How can I fix it? The code below is the same I have in the event (and using the same script in both scenes):
*Scene escenaActual = SceneManager.GetActiveScene();
string nombreDeEscena = escenaActual.name;
Debug.Log(nombreDeEscena);
if (nombreDeEscena == "scene2")
{
Application.Quit();
SceneManager.LoadScene("scene", LoadSceneMode.Additive);
}
else if (nombreDeEscena == "scene")
{
Application.Quit();
SceneManager.LoadScene("scene2", LoadSceneMode.Additive);
}*
Unless you want to keep the objects of the first scene you should change the LoadScene$$anonymous$$ode to .Single ins$$anonymous$$d of .Additive that way it won't keep the objects of the first scene. If you want to keep some objects from the initial scene use the DontDestroyOnLoad function. Now if you want to keep everything from the initial scene you have to design next scene based on the first so objects won't get mixed up. Lastly to save a Scene you can go to File->Save as->name it and save it, after that the scene will be inside the asset folder unless you change it, double click it and will bring up the saved scene. You can have as many scenes you want. Hope that helps.
Thanks, the problem was just that, the "LoadScene$$anonymous$$ode.Additive" I changed it to "Single" and everything is working. Just keep having a little problems with the colors of the objects now, but I think I can fix it easy. Greetings and have a nice new year!
Answer by EngineGeek12 · Jan 01, 2017 at 05:03 PM
Go to File, save scene as, then save to the Unity Game Location
Go to: Documents, " The Projects Name" then name the scene
You can then save it and make a new scene
I hope this helps... I would wait for another person to answer because It's always good to get even more help
Also, make sure that you let me know if it works, just want to make sure your problem is solved...
Thank you, I saved the scenes before, but the problem was in the LoadScene$$anonymous$$ode method. As says "PizzaPie" above, using LoadScene$$anonymous$$ode.Single ins$$anonymous$$d of LoadScene$$anonymous$$ode.Additive, in the moment to change the scene, all objects of the first scene has been destroyed. Have a nice new year!
Your answer
![](https://koobas.hobune.stream/wayback/20220612103812im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
So i want this problem with ui buttons done 1 Answer
Adding EventTrigger.Entry to EventTrigger component via script doesn't update component's editor UI 0 Answers
multiple of same objects from DontDesroyOnLoad 0 Answers
EventSystem.current is returning null 0 Answers
Need help with trigger event! 0 Answers