Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Multiple scenes or a single scene..

Discussion in 'Getting Started' started by xxufl, Feb 11, 2015.

  1. xxufl

    xxufl

    Joined:
    Jan 7, 2015
    Posts:
    4
    Hi guys, so I'm pretty new to Unity and have been watching many official and non-official Unity tutorials, and I have a plan for a game where there's basically 3-4 different screens per 1 level. To be more specific, basically you start a level and you're looking at one screen and you cannot change the camera position but you can click on the screen to perform various tasks. However, within a level you can also move to different screens and those other screens might be similar to the first screen you were looking at or be different and like I mentioned earlier, there will be multiple screens you can switch around within one level.

    40548-untitled.png

    My question is that I'm not sure if I should include all the screens which are in one level to one scene or if I should separate scenes for each screen even within a single level. The former sounds more reasonable to me but that means duplicating basically the same or similar objects in one scene for different screens and the hierarchy would get all messy and stuff. The latter would make the hierarchy less messy, but it's going to be a pain to manage scores and other values across scenes and I have planned to make variables that should change and remain within one level and other variables which will be consistent(well not exactly 'consistent' but you get what I mean) across levels. I'm not even sure which variables to make static and what not to make static. It just gets more and more complicated when I consider the inventory systems and child objects(I mean, how am I supposed to manage inventory items(which only way I can think of to store them is to make them child objects of the inventory game object) in different scenes to make them consistent? I'm a freaking novice).

    So this was a relatively long question but I really could not find answers for this particular situation anywhere(which may be due to my incompetence at searching) so I will be really grateful if anyone could find the answer for this situation for me. Thanks for reading.

    p.s. I originally posted this on Unity answers, which got rejected so I just copied and pasted everything so excuse me if this still kind of sounds like a question than a discussion
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    It might be helpful to have a bit more info on what's contained within each level and screen. Is this a 3D environment (regardless of whether you move the camera or not) and each screen would represent a different view of that area? If so, it definitely makes sense to keep it one scene and just move the camera or switch to a secondary/tertiary one.

    Even if each "screen" is showing something totally different, it may still make sense to keep things in one scene. Again, you could just have other cameras that are pointed at different geometry in your level and switch cameras as appropriate.

    It probably mostly depends on how much is too much for you to handle while working. If things are too cluttered with everything in one scene, consider how to break it up better into separate scenes.
     
    xxufl likes this.
  3. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,706
    When I read your initial description I thought maybe you might want to look into using additive scenes. This is something native to Unity, but there is a tool that simplifies using additive scenes that also has some demo video stuff you might find interesting (if indeed additive scene loading is for you).
     
    xxufl likes this.
  4. xxufl

    xxufl

    Joined:
    Jan 7, 2015
    Posts:
    4

    I didn't really want to disclose it, but I guess I'll have to.
    I'm trying to build a game where basically there are multiple mining spots you can visit which are essentially fixed screens you cannot really move around, respectively. But I also have a plan to make like a shop amid those mining spots so they're not all the same I guess. A novice I am, I haven't thought of making multiple cameras and it actually sounds like a really good idea to me, so props to you. After reading your reply, I have also thought about making empty game objects for different 'screens' within a scene and I think it would resolve the problem of having everything cluttered in the hierarchy.
    Do you think that method would work out? Because I'm not sure if it could bring about any other problems like collision and stuff because I once had a problem with child objects' colliders being ignored.
     
  5. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Sounds like you've got the right approach in mind now. I'm sure you'll run into issues, but figuring them out is all part of the fun, right? :)

    And I wouldn't sweat sharing ideas here. Ideas are a dime a dozen. It's how you execute on them that matters, and even if someone tried to pull off your base idea, it's likely the game would be totally different if they went forward with it.

    Best of luck! Keep us updated on your progress!
     
  6. xxufl

    xxufl

    Joined:
    Jan 7, 2015
    Posts:
    4
    That actually looks really cool and could really be used to my advantage. However, the only problem is that the only way I know to make the inventory system and create variables that last throughout 1 level is for the inventory system, to have them(inventory items) as child objects(which I'm not even sure how I'm supposed to display them on screen for the user to access) and for the variables, to make them static which I don't really want to because I thought I would make variables that remain constant throughout all levels static, but then again, I have no idea how to pass non-static variables throughout multiple scenes.

    So the question I have right now is that is there a way to make like a base scene where you could store all the stuff like inventory and variables-that-last-for-1-level and like in the plugin you suggested to me and have and be able to view all the subscenes in the base scene? I mean like it'd be really awesome if I could pass objects from a subscene to the base scene just for stuff like inventory or something..
     
  7. xxufl

    xxufl

    Joined:
    Jan 7, 2015
    Posts:
    4
    Thanks. I thought I had almost set my destination until the other guy named "hopeful" suggested to me a different solution which sounds more complicated to me due to variable management and stuff but looks workable and efficient for bigger projects that the one I'm planning on because I do all my development work alone as of now. Anyways, I think I'll adopt your way for now(no offence to "hopeful", this way just seemed simpler for now) and see how it turns out.

    Cheers.
     
  8. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    In my opinion, trying the simplest solution first is best. If you realize you need something more powerful or complex, figure it out from there, but don't make things more complicated than you absolutely need to right out of the gate.
     
  9. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,706
    I'm not sure I understand the problem you are attempting to frame, but the idea with using additive scenes is that you can have a main scene that contains all the stuff you want to persist throughout the game, and then you add subscenes as needed to act as your different levels. When a level is done you unload the associated subscene, but your original scene remains.
     
  10. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    @hopeful I knew nothing about additive loading of scenes before hearing about it from you, but it actually appears to be the solution to a problem I anticipated having soon. Thanks for the suggestion!

    However, it is worth noting that asynchronous additive loading is a Pro only feature.
     
  11. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,706
    The async version is Pro only (and from what I hear it actually works properly now what with Unity 5 being multithreaded), but plain LoadLevelAdditive is available to indie users, so the desired function is there. If your subscene is large you will want to have a scene loading animation of some sort. In which case, it's not so different from loading a new scene, except of course for the persistence of the original scene elements.

    If all you're doing is bringing in a new UI screen or small level map on your additive scene, it can be pretty fast. If there's a small hiccup on slower devices you can conceal it with a fade out/in.