Resource Type

Databox supports Unity resources types by storing it's resource path. When calling the GetData on a Databox object with a ResourceType Databox loads the prefab automatically.

Example of loading a GameObject:

        // Loads a resource of type GameObject
        var _go = db.GetData<ResourceType>("Assets", "Player", "GameObject").Load() as GameObject;
        Instantiate(_go, Vector3.zero, Quaternion.identity);

Example of loading a Texture2D:

        // Loads a resource of type Texture2D
        var _thumb = db.GetData<ResourceType>("Assets", "Player", "Thumb").Load() as Texture2D;



Addressables

Databox also supports the newly introduced Addressables by Unity. Addressables are still in Beta, therefore it's possible that some features might change or break.

Install

  • To use the addressables you need to first download the addressables package with the package manager inside of Unity.
  • Make sure to open the addressables window for the first time. Go to: Window -> Asset Management -> Addressables. This is important so the addressable system can do some setup.
  • Now open the AddressableType.cs script inside of the Databox folder: Databox -> Types -> AddressableType.cs.
  • Uncomment the script and wait for compilation.
  • When adding a new value you can now select the addressable type.
  • The addressable type in Databox simply saves the addressable path. You can select all available assets by a dropdown.
  • To know how to use addressables (Instantiate, Loading) please refer to the official documentation here: Addressables Documentation