How Asset Data works
The AssetData
system is divided in a few classes:
AssetData
system is divided in a few classes:Assets
Assets
This
class
caches all theAssetDatabases
in the game, its where we retrieve the asset we want. We can use the getters to specify which asset from a database to retrieve it.
DatabaseAsset
DatabaseAsset
A
class
that contains a reference for theName
andDatabaseName
of an asset, this is used to load them in a convenient way as the class is used when we generate the database code.
AssetDatabase
AssetDatabase
ScriptableObject
that loads all assets present on anAddressablesGroup
, adding them to a list of assets and generating astatic class
withDatabaseAssets
related to those assets.
WorldObjectAssetReference
WorldObjectAssetReference
A
class
used for world object assets, assets that can be placed in the world as aGameObject
, this has the purpose of creating a way to reference database assets via the inspector, without having to look for a prefab, it is also generated by the asset data system.
AssetDatabaseSettings
AssetDatabaseSettings
a
ScriptableSettings
class that loads all theAssetDatabases
. Everything here is automated, you don't have to mess with. Its useful to see if all the databases are loaded, or to ignore code generation.
How it works
Whenever the code/asset generation is triggered, the system will scan for asset databases that are not loaded, load them in the list and then start the generation process.
The generation process simply iterates through each database and generate a static class of an DatabaseAsset
for each item in the database.
The system will also generate a bunch of WorldObjectAssetReferences
, this is done on all assets that can be cast to GameObjects, they can be used in the inspector to reference an database asset.
Last updated