Search Unity

storing data about each level's construction

Discussion in 'Scripting' started by ullman, Apr 18, 2015.

  1. ullman

    ullman

    Joined:
    Dec 29, 2014
    Posts:
    7
    Just wondering what the "usual" process is for storing data for building levels within one scene. Here's what I mean. Say I'm making a game like Breakout(maybe a bit more complex) and I don't really want to have multiple scenes for every level, rather I want to store info about how every level is constructed, like types of breaks, where the breaks are located, what items you get, etc. What's a good way to store this information about every level and call them when needed? just through inspector using a master GameObject? Is there a process developers tend to use most of the time? Any info would be great, thanks.
     
  2. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,539
    Have a config file.

    I'd probably use XML just because I like the ease of writing XML, and the fact that the System.Xml.Linq namespace contains classes that make parsing out the xml super easy.

    Json is another common one.

    As are custom formats.

    Then yeah, have a GameObject with a script on it that does the building of the level. Make sure there's a property on it to reference the config file.
     
  3. proandrius

    proandrius

    Unity Technologies

    Joined:
    Dec 4, 2012
    Posts:
    544