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

Which method to make games with ?

Discussion in 'General Discussion' started by BboyZeez, May 12, 2014.

  1. BboyZeez

    BboyZeez

    Joined:
    Aug 14, 2013
    Posts:
    3
    Hi all

    so i am making multiplatform games with unity , but say for example you have a title screen , main menu screen and then playing level screen , should you use scenes for each of these or would you simple use a enum gamestate and then for example change backgounds and make objects inactive when not in use etc?

    Thanks

    Aaron
     
  2. Kellyrayj

    Kellyrayj

    Joined:
    Aug 29, 2011
    Posts:
    933
    Both ways work. I think I would opt to keep my menus in the same scene.
     
  3. MarkrosoftGames

    MarkrosoftGames

    Joined:
    Jan 5, 2012
    Posts:
    442
    it could depend on your game. if you have a huge complex menu, or you simply just want to keep it separated logically from the actual game you can.

    also loading times can be a factor here. if you want them to be able to get into the game right away then keep it in the same scene.
     
  4. BboyZeez

    BboyZeez

    Joined:
    Aug 14, 2013
    Posts:
    3
    ok thanks but i should have a different scene for menu and a different one for actual level playing?
     
  5. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    It's Unity so both will work. I'm sure someone here has technical knowledge of the engine to tell you which is better performance wise, but I've never made a project that had more than 1 scene.

    In OnGUI I have something like..

    switch(menuState)
    {
    case 0:
    mainMenu();
    break;
    case 1:
    ingameGUI();
    break;
    }

    and then I define those functions to draw different things on the screen. When entering a stage, I dynamically instantiate prefabs on the scene. When doing some kind of level transition, all I'm doing really is destroying everything on the current scene and instantiating things that make up what is conceptually the second level. If that's going to take a while, I'll put up a loading screen which is just monitoring the progress of items created.
     
  6. BboyZeez

    BboyZeez

    Joined:
    Aug 14, 2013
    Posts:
    3
    ye thats what i did on a simple autoscrolling game i made but now i doing levels etc so i thinking maybe go for the separate scene for the playing and title/mainmenu , if anyone with technical knowledge can reply that would be great thanks
     
  7. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    619
    You shouldn't really base it on performance, as doing it all in the one scene is obviously going to be better every time, however it's most likely going to take a lot more work to do over doing it in different scenes.

    Different scenes:

    + Easier to manage, just make your menu items, centre your camera, add some Click events
    + Easier to set up testing - want to skip your main menu every time you test your game? Just load your game scene, skip the menu scene
    - Probably slower, Unity has to load the next scene
    - Doesn't have many options for transitional effects or animation

    Same scene:

    + You can do any transition/animation effects between your menu and your game
    + Faster, probably no loading screen
    - Your scene will very likely end up very large, and cluttered - it's harder to manage efficiently
    - It's (a little bit) harder to set up at the start. You have to have multiple cameras
     
  8. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    Hey you, again. I've got a related question.

    Would it be better to build your scenes and transition by loading scenes, or build your scene and then parent the entire scene to an empty GameObject called "level 1", make it a prefab and instantiate it at run time when needed?
     
  9. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    619
    You can't 'parent' a scene to a GameObject, nor can you instantiate a scene.

    If you're talking about parenting all of your GameObjects in the game scene into one super prefab, and then instantiating that prefab.... You should probably put all of the common stuff that is shared amongst levels (Your characters, lights, audio manager, etc) in the scene directly, and just put your level objects (your terran/models/sprites/textures/etc) into prefabs, and switch out the prefabs for different levels

    Don't put EVERYTHING into the 1 prefab and instantiate that. Just instantiate/destroy what you need, and keep everything else in the scene

    Honestly if you're just starting out, just use different scenes. It's much easier to manage, and setup
     
    Last edited: May 13, 2014
  10. Tomnnn

    Tomnnn

    Joined:
    May 23, 2013
    Posts:
    4,148
    I did mean gameobjects, thanks. I've had a pretty easy time so far using a function to instantiate a series of prefabs for level creation. The only time I use scenes / levels is to "reset" the game since my attempts to do so manually have been sloppy thus far.
     
  11. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    619
    That's right, and that is another major advantage of using Scenes. You want to reset your game? Simply reload your scene. (Not necessarily an optimal way of going about resetting your game, as loading a scene can be slow, but it is quick and easy to implement)

    Trying to keep all your levels in 1 scene means extra work you need to do to reinitialize all your objects.