Hi, i have 2 scene in my program, when i click a button i go to the second scene and when i press home button (in the second scene) i go to the previous scene, how can i keep loaded the first scene?
Load the second screen additively, then unload it.
Additive scenes are one possible solution:
https://discussions.unity.com/t/820920/2
https://discussions.unity.com/t/820920/4
https://discussions.unity.com/t/824447/2
A multi-scene loader thingy:
Other notes on additive scene loading:
https://discussions.unity.com/t/805654/2
Timing of scene loading:
if i load the second scene additively the first scene overlaps the second, what i want to do is example: scene1: move a cube, click scene2 button, scene2 opens, click on scene1 button, scene1 opens with the same changes i did when i started move the cube on scene 1
You could turn off all the items in scene one (disabling them), then turn them all back on when you come back.
You could also use separate cameras that see different parts of the two scenes.
Alternately you can store away changes in scene 1 (perhaps serializing them to a GameManager type construct or some other long-lived item) and then restore those changes when you reload scene 1.
There’s a lot of different ways to structure it, it all comes down to what you’re trying to do.
can I show you the project via anydesk or discord to better show you what I want to do?
No that’s not really my thing, sorry. You might want to try some more tutorials on GameManagers and setting up permanent state so you can transition scenes and return to a previous state. It’s fundamental enough that you probably want to understand it for all the other places it might be useful, such as choosing a player avatar in a “new game” screen, then going into the game and using it.
there is a classic alternative to do things without having extra scene or complicate transfer data from one scene to another.
first story: an open world game with ability to go into a building, but when the player outside the building, all the furniture inside the buildings take a lot of memory space and performance so they make inside the building a new scene then they found out loading back to the main scene took a long time so they end up have only main scene but with underground secret location where all the inside building set there and all they did is teleport the player there.
second story: a first person shooter has their arms go through wall when the player near the wall so they build 2 cameras system.
combine these 2 stories knowledge and you don’t even need a second scene and complicate script that you can’t code.
Thank you guys @Putcho @Kurt-Dekker , i finally found a solution that fits well, basically i deleted the first scene and loaded all the two scenes simultaneously, then at program start i disabled the objects on second scene and when i go to the second scene enable the objects on second scene and disable objects on the first scene, the only problem i have is with the tooltip script that is buggy when “I change scene”
Sadly this does not work if you have baked lighting.