Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved How can I Load and unload addictive scenes multiple times

Discussion in 'Editor & General Support' started by Tidcy, Jun 9, 2021.

  1. Tidcy

    Tidcy

    Joined:
    Apr 15, 2020
    Posts:
    53
    hello I’m making a mobile game where there’s an arcade machine with lots of small games on it, this image explains it more
    D20264C7-2823-45A3-B96B-E494F9CA3885.png C4BA8480-AE12-44F3-A97F-0F04C84B9AAA.png
    Now, the way it basically works is I have every game in its own scene, and the camera from there renders it on the arcade monitor.

    I’ve learned about additive scenes and It works great, but I’m a bit lost around unloading the scene when the player wants to play another game.
    I want the player to be able to play all the games again even after unloading them, so im not sure I can use unloadscenesasync (it says in the scripting api that it destroys the scenes and all game objects within it) and as far as I know that means that that scene can’t be loaded again.

    Is there any way to load one additive scene at a time and close it when another addictive scene is loaded but still be able to load it again? Thanks in adv
     
  2. TimmyTheTerrible

    TimmyTheTerrible

    Joined:
    Feb 18, 2017
    Posts:
    186
    You can unload and reload the scene as much as you like. Your game objects are destroyed when a scene is unloaded, but a scene is just a file with a list of objects that are instantiated as the scene is loaded. Destroy something in a scene, and it will exist again when you reload it.
     
  3. Tidcy

    Tidcy

    Joined:
    Apr 15, 2020
    Posts:
    53
    Thank you for the explanation!!