> For the complete documentation index, see [llms.txt](https://ss3d.gitbook.io/systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ss3d.gitbook.io/systems/asset-data/how-asset-data-works.md).

# How Asset Data works

## The **`AssetData`** system is divided in a few classes:

### <mark style="color:purple;">**`Assets`**</mark>&#x20;

* This <mark style="color:blue;">`class`</mark> caches all the <mark style="color:purple;">**`AssetDatabases`**</mark> 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.

### <mark style="color:purple;">**`DatabaseAsset`**</mark>

* A <mark style="color:blue;">`class`</mark> that contains a reference for the **`Name`** and **`DatabaseName`** of an asset, this is used to load them in a convenient way as the class is used when we generate the database code.

### <mark style="color:purple;">**`AssetDatabase`**</mark>

* <mark style="color:purple;">**`ScriptableObject`**</mark> that loads all assets present on an <mark style="color:purple;">**`AddressablesGroup`**</mark>, adding them to a list of assets and generating a <mark style="color:blue;">`static class`</mark> with <mark style="color:purple;">**`DatabaseAssets`**</mark> related to those assets.

### <mark style="color:purple;">`WorldObjectAssetReference`</mark>

* A <mark style="color:blue;">`class`</mark> used for world object assets, assets that can be placed in the world as a <mark style="color:purple;">**`GameObject`**</mark>, 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.

### <mark style="color:purple;">**`AssetDatabaseSettings`**</mark>

* a <mark style="color:purple;">**`ScriptableSettings`**</mark> <mark style="color:blue;">class</mark> that loads all the <mark style="color:purple;">**`AssetDatabases`**</mark>. 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.

{% hint style="info" %}

## The system will automatically load all databases and generate the code/assets for it when a project reload is triggered or when the UI for the settings is opened.

{% endhint %}

## 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 <mark style="color:purple;">**`DatabaseAsset`**</mark> for each item in the database.

<figure><img src="https://3495811604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F95OhrYYgKj0eUTnfM9sL%2Fuploads%2FV9m30tL9iWEJYT8KP4DD%2Fimage.png?alt=media&amp;token=be2425c2-a28e-4044-a611-4d30d9e9dd37" alt=""><figcaption><p>This is an example of a generated class.</p></figcaption></figure>

The system will also generate a bunch of <mark style="color:purple;">**`WorldObjectAssetReferences`**</mark>, this is done on all assets that can be cast to GameObjects, they can be used in the inspector to reference an database asset.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ss3d.gitbook.io/systems/asset-data/how-asset-data-works.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
