Doloro GDK 22 .1.0 Beta
by Tauri Interactive
Dynamic Resources Database

About

DRD is a highest level API that encapsulates entire resources managing process providing you an interface that allows to access the resources by them signatures skipping other stages.

Explore API: Doloro.DataManagement.DynamicResources.DynamicResourcesDatabase


Setup

Before the database will gets data, you need to request it.
You may do this in 2 ways:

Manual

To call the database data loading via API you need to follow next steps.

  1. Call DynamicResourcesDatabase.LoadResources() static handler.
  2. Subscribe on DynamicResourcesDatabase.onLoaded event.
    It will be called as soon as async process of resources search will be finished.
  3. Await till the callback from event signed up on previous step will be called.

After 3rd step the database data has been loaded and can be used.

ABT Integration

If you are using Asset Bundles Tools module you no need to handle manual call of data base loading.
But you still need to add a loader to the AssetBundlesLoader.

To setup the loader, follow next steps:

  1. Select game object with AssetBundlesLoader component.
  2. Add DynamicResourcesLoader via add component menu by
    Doloro GDK \ Data Management \ Asset Bundles Tools \ Dynamic Resources Loader path.

Now the loader will be automatically enqueued and handled by the AssetBundlesLoader after it fish with bundles loading.

See also:


Using

When the database has been loaded, you can check it by using isLoaded property, you may access a DynamicResource prototype via its signature.

Example

if(!DynamicResourcesDatabase.isLoaded)
{
// Database has not been loaded.
// Request the load or throw an exception here.
}
// Requesting the resource by its signature
// Validating its type to be the expected.
if(DynamicResourcesDatabase.Find(RESOURCE_BUNDLE, RESOURCE_KEY) is EXPECTED_TYPE prototype)
{
// instantiating the prototype to on-scene object.
var isntance = UnityEngine.Object.Instantiate(prototype);
}
else
{
// Resource has not been found or has unexpected type.
// Throw an exception or use default \ placeholder object.
}
Member Type Meaning
RESOURCE_BUNDLE string DynamicResource.bundle to search.
RESOURCE_KEY string DynamicResource.key to search.
EXPECTED_TYPE Type Expecting type of the receiving DynamicResource object.
DynamicResource in most cases but could be other in case you are expecting a derived class.