Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by danimarti · Jul 01, 2019 at 03:15 PM · multiplescenesadditive

Additive Scenes, best way to hide content?

Hi, in my game I use procedural generation to create my levels and I was thinking on using additive scenes for when the player enters in a room. That way, the room loads seamlessly and the player can enter to the room and when he leaves it, the level is still there. If I load and unload the scene with the main level, it will be different as it gets generated on the fly. The issue I'm having is I want the room to hide the content of the level but I can't really hide an scene, I have to unload it (which I'm trying to avoid). By the other hand, another solution could be using a different camera, but that means I have to duplicate layers for elements such as obstacles for example, to be able to render each obstacle in its camera. Any idea to accomplish something like this? Thanks so much!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by lnwhitling · Oct 21, 2021 at 08:44 AM

@danimarti Hope this doesn't count as a necro - the question is at the top of the Google results when I searched for it.


I had a similar requirement, where I needed a persistent "world map", and then "rooms" that the player can go into, which are loaded on the fly.


So I parented my entire "world map" to a single object, and simply disabled that object. The lighting etc was outside the world, so that was all preserved. And likewise, returning was simply a case of unloading the room and then re-enabling the world-map parent.


Imma just dump my class here (as it is also responsible for disabling the audio listener on the world-map camera):

 public class GameManager : MonoBehaviour
 {
     public WorldMap WorldMap;
 
     private bool InWorldMap => WorldMap.gameObject.activeInHierarchy;
 
     private void Start()
     {
         Application.targetFrameRate = 60;
     }
 
     private void Update()
     {
         if (Input.GetKeyDown(KeyCode.Return))
         {
             if (InWorldMap)
             {
                 GotoTactical();
             }
             else
             {
                 ReturnToWorld();
             }
         }
     }
 
     private void GotoTactical()
     {
         WorldMap.DisableAudioListener();
 
         var operation = SceneManager.LoadSceneAsync("Tactical", LoadSceneMode.Additive);
 
         StartCoroutine(WaitForOperation(operation, () =>
         {
             WorldMap.gameObject.SetActive(false);
         }));
     }
 
     private void ReturnToWorld()
     {
         var operation = SceneManager.UnloadSceneAsync("Tactical");
 
         StartCoroutine(WaitForOperation(operation, () =>
         {
             WorldMap.gameObject.SetActive(true);
         }));
     }
 
     private IEnumerator WaitForOperation(AsyncOperation operation, Action completion)
     {
         while (!operation.isDone)
         {
             yield return null;
         }
 
         completion();
     }
 }





Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

180 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Playing audio through multiple scenes 2 Answers

Cross-Scene Simulation? 0 Answers

Complicated level change problem 1 Answer

How can I merge 2 scenes into one project? 0 Answers

Void being called 4 times, no apparent reason 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges