Search Unity

Datablocks - Hierarchical Data Management

Discussion in 'Assets and Asset Store' started by Bigpete591, Apr 3, 2015.

  1. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    Introducing Datablocks for Unity!



    Asset Store | Website | Docs

    For the first time you can now create your game data in the same way you think about it, in a hierarchy! Make a change along any step of the hierarchy and all the children will receive the updated value.

    ItemDatablock example hierarchy:


    In this example, the final item "Magic Plate Armor" is inheriting the values from all its parents. At each step in the chain, a datablock can choose to set its own values, rather than using its parents.

    Building your data in this manner gives you incredible power to change your game down the line as your game evolves. For example, if you wanted to change the sound effect of striking against plate armor, just change the value on the Plate Armor datablock, and all the items that inherit from it will have the new sound effect.

    Key features for developers:
    Built using ScriptableObject as a base - Enables full use of the inspector
    Import and export from Google Sheets
    All platforms supported
    Full source included

    Screenshots



    Asset Store | Website | Docs
     
    Last edited: Apr 25, 2015
  2. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    76
    Does this support child objects adding new fields? In your spell example, say there's BaseWeapon with name, damange, etc., and then a child MeleeWeapon and RangedWeapon. Could RangedWeapon add a "range" property? Or does BaseWeapon need to list out all of the possible properties to be used by any child?
     
  3. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    Datablocks supports optional displaying of fields based on the value of another field. In your example, the datablock class might be setup like:

    Code (CSharp):
    1. public enum ItemType
    2. {
    3.     Melee,
    4.     Bow,
    5. }
    6.  
    7. public ItemType itemType;
    8.  
    9. [DatablockEnum("itemType", ItemType.Bow)]
    10. public float range;
    This will tell the editor to only show the "range" field if the itemType is "Bow". The included ItemDatablock example class makes heavy use of this feature.

    More information can be found here.
     
  4. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    76
    Just a small bug report, but the DatablockManager editor window's doesn't filter properly on items that have namespaces.

    For example, the filter gets set to [T:My.Namespace.MyDatablock], and it doesn't work. If I manually change it to [T:MyDatablock] then it works.
     
  5. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    Thanks for the bug report.

    I've fixed the issue and it will be included in the next release. If you shoot me an email at support@unitydatablocks.com I will send you the updated file so you don't have to wait.
     
  6. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    76
    Thanks for the fix! I was planning to wait on it hitting the asset store, but it never seemed to make it. Is the update still planned for the store?
     
  7. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    Sorry for the delay, the new version was submitted and is waiting for Unity's approval.
     
  8. sballew7

    sballew7

    Joined:
    Sep 3, 2013
    Posts:
    76
    Thanks again for the Datablocks asset, I've been using it pretty heavily.

    Just a heads up, I noticed there is a class under Datablocks/Scripts/Utils/Util.cs. It does not use a namespace, and a pretty generic name like 'Util' collides easily. I am dealing with it colliding right now. I am not sure if other Datablock classes reside in a namespace, but I think it would be a good idea!

    Thanks again.