Search Unity

Vault Core

Discussion in 'Assets and Asset Store' started by LaneFox, Mar 3, 2021.

  1. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536




    < Vault Ecosystem >
    | Core | Inventory | Attributes |


    This asset is the foundation of the Vault Ecosystem! It offers a strong back end with which you can design items and game systems. It is easily extendable and very friendly for designers. It is firmly rooted on the ScriptableObject class which is tried-and-true, stable and easy to work with.

    Discounted price Upgrades are available to the rest of the Vault Ecosystem Assets


     
    TeagansDad and TonyLi like this.
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,446
    Is this right tool - if i want to create game with hundreds of interactive objects in the world?
    with custom properties, that i'd provide (and then use from my own scripts): like weight, flammable, floating..

    and can i save/load any property changes in some way with game save/load system or does the database mean there is actual db behind (that is persistent) ?
     
    LaneFox likes this.
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    The database is designed to be static in the build. You can easily add properties to any data entity you want, but consider the data you design in Vault to be static.

    You could use the database as a 'base' of your own system which references the vault content and builds your runtime objects with some other data you've saved somewhere, thus producing unique object instances with properties you've defined at runtime, serialized in json or something.

    How you interact with the data saved in Vault is entirely up to you.
     
    mgear likes this.
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    Basic inheritance applies here. You created something like
    public class PlayerData : DataEntity
    and need to cast it to the deepest type you want access to. Vault is only going to operate on the base class
    DataEntity
    with the Get functions.

    For good design practice you should only cast the type or use the Get function when you have no other options. Ideally you would just expose a
    PlayerData
    variable to the inspector on some player prefab and use the
    [AssetDropdown(typeof(PlayerData))
    ] attribute decorator to make it a dropdown selector, then read all your 'dumb-data' in the vault through that variable. We do this in the Prodigy Game Framework we're releasing next year and rarely have to cast types because the dropdown variable is the type and reference that we want already.

    Also note that Unity doesn't allow referencing scene objects in project assets - which is the only reason I can think of that your "hometown" would be a transform variable in the database. You might consider instead that your Hometown in the database would be more like "HometownDefintion" or "HometownData", then something at runtime would reference that.

    Here's some example code
    Code (CSharp):
    1.     public class TownData : DataEntity
    2.     {    
    3.         public int ResidentCount;
    4.         public string OfficialTownName;
    5.  
    6.         protected override void Reset()
    7.         {
    8.             base.Reset();
    9.             Title = "Bob's town";
    10.             Description = "Bob started this town in '56";
    11.  
    12.             OfficialTownName = "Robertsville";
    13.             ResidentCount = 3000;
    14.         }
    15.     }
    16.  
    17.     public class RuntimeTown : MonoBehaviour
    18.     {
    19.         [AssetDropdown(typeof(TownData))]
    20.         public TownData DefinitionData;
    21.         public Transform TownTransform;
    22.     }
    23.  
    24.  
    25.     public class PlayerData : DataEntity
    26.     {
    27.         public TownData Hometown;
    28.     }
    29.  
    30.     public class RuntimePlayer : MonoBehaviour
    31.     {
    32.         [AssetDropdown(typeof(PlayerData))]
    33.         public PlayerData DefinitionData;
    34.         public Transform TownTransform;
    35.  
    36.         public string GetHometownName()
    37.         {
    38.             return DefinitionData.Hometown.OfficialTownName;
    39.         }
    40.     }
     
    Last edited: Dec 5, 2021
  5. heddesheimer

    heddesheimer

    Joined:
    Oct 23, 2019
    Posts:
    4
    Thanks. I meanwhile found the solution, as I referenced the base class and not the derived class for characterData.

    But I have a different problem now. It works fine to store the player's current position in-game every 10 seconds. I can stop gameplay in the editor and continue at the last save point when starting again. But when I build a Windows version of the game, it seems not to store the data.

    Is there something that I need to set up in build settings so that the Storage Folder will be created in the final build? I looked in the files and could not find a Folder called "Storage" in the final build, so I think this is the reason why my player position does not get stored. I don't need any multiplayer storage, it's just a single-player game and I would like to get some simple data stored, like the last player position.
     
  6. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    All folders in the project hierarchy are compiled by Unity when you make a build. That content is not visible as files after you make a build. It sounds like you're trying to save data at runtime and load it back in at runtime which is not what Vault does. Vault lets you design everything in the editor very easily and reference that data in a build.

    If you need a runtime Save/Load system, you might look at some of these solutions:

    Easy Save
    Play Mode Save
    SAVE-IT Pro
    Bayat - Save System

    At the very bare minimum you can shovel everything into Unity's built in PlayerPrefs if you want to. It's just text data in the Registry.

    Note that those are not Database systems so you'll need to explore how each one solves the save/load problem and integrate whatever you've created in Vault from there.
     
  7. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    Final Sale of 2021 is Live!
    A huge number of assets are on sale as well as all Vault systems and some of our 3d art packs! This is a great time to expand your dev toolbox!

    Discounted Cleverous Assets:
    Vault Core
    Vault Attributes
    Vault Inventory
    Zed
    Quinn

    Coupon Code
    Use the coupon code HELLO2022 for an extra discount on any purchase over $150. This works for any purchase on the store - not just our assets!
     
  8. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    Vault Core Overhaul!

    Core Screenshot.png core screenshot 2.png

    Changes:
    • Custom Groups! Even type groups are built on the fly as custom groups, but your own Custom Groups are actually stored in the Database as DataEntities and accessible like any other data! Quick access on the left column makes this a useful feature.
    • Database now is a Dictionary with Unique Key Lookup!
    • Unique permanent Database Key for all DataEntities instead of lookups by Index. This greatly reduces the lookups on the DB and further reduces the need for string lookups by entity title!
    • Improved example with a more practical use case - displaying character info!
     
    TeagansDad likes this.
  9. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,536
    Update 22.6.2

    Code (csharp):
    1. // Vault Core: Fixed dashboard clearing on assembly reload
    2. // Vault Core: Fixed intermittent bug with DB not reloading when it should, causing failures when trying to bring in new DataEntity classes to the system.
    3. // Vault Core: Added better filtering with property values. Use [VaultFilterable] on your string, int or float class fields
    Along with fixing two long time nuisance stability bugs, this version introduces the ability to filter your data based on the value of some properties in the class. Previously, only Title searching was available. This greatly expands the searchability of your data is a big QoL feature.

    Filter_1.png

    The red section is the filtering tools.

    Filter_2.png Filter_3.png

    Here you can see them expanded on the demo content, and the results of a filter operation. The operation is immediate, so any change will filter the selection of content. In the future we'll likely expand this to support more types, allow your own extensions and include null checkables.