Search Unity

To scene or not to scene

Discussion in 'Scripting' started by IISYNII, May 28, 2015.

  1. IISYNII

    IISYNII

    Joined:
    Feb 1, 2015
    Posts:
    8
    i have a car game and i need help the game will eventually have many cars is it better to have a scene for each race for each car or have all the cars in one scene only set active if that car was selected or is there another way
     
  2. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    A scene contains a logical piece of your whole game. A level, the start screen, a longer cutscene in game graphics.
    In a race cars usually belong to a scene so you should make a level a scene and the different cars selectable.

    Think the other way round: if you had 10 cars and made the same scene for each car you would have 10 scenes alone for each level. Make everything as reuseable as possible.
     
    krougeau likes this.
  3. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
  4. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    I don't think objectpooling will help you, better off to build a scenes for your levels than instantiate in the cars you need.
     
  5. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    A mixed of what @krougeau and @passerbycmc said.

    Make a prefab of every car, and Instantiate the one that was selected in the race.
     
  6. Deleted User

    Deleted User

    Guest

    Prefabs Bro.... Prefabs.
     
    sluice likes this.
  7. sluice

    sluice

    Joined:
    Jan 31, 2014
    Posts:
    416
    Yup, It's a good practice to make a prefab of pretty much everything you will use in your scene.