Search Unity

How should I store my Dialogue?

Discussion in 'Scripting' started by ReleeSquirrel, Aug 30, 2014.

  1. ReleeSquirrel

    ReleeSquirrel

    Joined:
    Aug 21, 2014
    Posts:
    14
    I'm scripting up a dialogue system for my games and I realized that I'm not sure how to store the dialogue itself. It seems like I'd have to write it all up in the scripts. I'd rather put it in a formatted text or binary file and load the data from that. Is that possible in Unity?

    How would you reccomend I store my dialogue trees? I'm open to other options, though I've got no budget so I can't afford either of the fancy dialogue systems on the asset store.
     
  2. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    XML, Text Asset, Scriptable Objects. Those could be used, I'd probably use XML for a dialogue system. If you google unity and XML there will be tons of resources to help you out.
     
  3. ReleeSquirrel

    ReleeSquirrel

    Joined:
    Aug 21, 2014
    Posts:
    14
    XML would be perfect. I'll try googling unity and XML and see what I can find. Thanks.
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,706
    Just sharing a couple things I picked up working on the Dialogue System:

    Jacob Pennock wrote a tutorial on using ScriptableObjects for a dialogue system. On the plus side, you can use the Unity editor's Inspector view to edit your dialogue. On the minus side, it's locked into Unity's serialized format, unlike text-based XML.

    The Unity Community tutorial on serializing XML might be helpful.

    There's also Parley, which has a free version. It generates text files in its own particular format, but it's simple to parse.

    If you have a copy of Neverwinter Nights 1 or 2, you can write your dialogue in the toolset and export to XML using Modpacker.

    Don't discount spreadsheet software like Excel or Google Sheets. A lot of games still write all their dialogue in spreadsheets. It's easy to import as comma-separated values (CSV).
     
    bbeecham and sandolkakos like this.