Content sources
Understand how content source providers store and load table collections and their assets.
Read time 4 minutesLast updated 14 days ago
Understand how content source providers store and load table collections and their assets.
A content source decides how the project stores localized content, how it ships in a build, and how it loads at runtime. Each table collection is assigned to one source. In the API, sources are implementations that return the requested localized content, and they live in the Localization settings as an ordered list.
IAssetProviderThe source chain
Requests walk the content source list until a source serves the address.
The Localization settings hold an ordered list of sources (). A request walks the list until a source serves it. The list allows one source of each type, and Default for new collections controls which source Unity assigns a new collection to.
AssetProviderBuilt-in sources
Localization provides the following content sources. You can enable them by adding them to your Content sources list in the Localization settings reference.
Source | Description |
|---|---|
| Direct references | The settings hold direct references to the collection's tables, and asset entries reference their assets. Everything loads synchronously with the settings. This is the simplest option and works best when all localized content can sit in memory. |
| Resources folder | Tables and assets load from |
| Data files (JSON) | Tables ship as JSON files in |
| Addressables | Tables and assets load through the Addressables system. Available if you install version 2.0 of the |
How Unity assigns a source to a collection
Each collection records the source that serves it. For most sources, the collection asset's window shows a source dropdown, and changing the dropdown re-registers the collection's tables with the new source in one undo step. No files move on disk.
Inspector
?
The Resources folder source is different: membership follows the collection's location, so the source dropdown doesn't include it. A collection saved under a folder belongs to this source, and moving the assets out of moves it off. Unity re-registers the collection whenever the assets move.
ResourcesResourcesA collection's assignment and location can disagree, for example a collection under that's assigned to another source. When this happens, the collection's Inspector window shows a warning with a button that fixes the assignment.
ResourcesAsset entries and sources
String entries live in the table, so the source only affects how Unity stores the table itself. For asset entries, you also need to decide how Unity stores each asset. That decision is per entry, not per source. A Direct entry references the asset, and a Resources entry stores a path. Refer to Localize assets.
Custom sources
Content that lives somewhere the built-in sources can't reach, for example downloaded content or a mod folder, needs a custom source. A custom source is a runtime that supports one or both loading paths (, ), paired with an Editor companion that registers collection content with the provider when you assign a collection to it. Requests arrive as an that carries the address and expected type.
IAssetProviderIAsyncAssetProviderISynchronousAssetProviderAssetKeyFor a complete example, refer to Create a custom asset provider. To add a custom table file format instead, refer to Create a file table provider for text files.