Version: Unity 6.7 Beta (6000.7)
Language : English
Content sources
Add a language to a built Player

Data file tables

Understand how table collections ship and load as data files instead of assets.

With a data-file source, a collection’s tables ship in the build as plain files, one per locale, instead of serialized assets. Translators can read and edit the files, you can patch a build without a rebuild, and you can add a language with a new file. The built-in format is JSON (JsonResourceProvider).

You can also create your own data-file source for custom file formats. Refer to Create a file table provider for text files.

Files and naming

Each table becomes one file named [collection-name]_[locale-code].[extension], for example Menus_fr.json. In a build, the files sit in StreamingAssets/{SubPath}. SubPath defaults to LocalizationTables, and you can change it on the source in the Localization settings.

From authoring to runtime

Unity generates data-file tables at build time and rebuilds them from files at runtime.
Unity generates data-file tables at build time and rebuilds them from files at runtime.

You author the collection in the Resource Tables window. The files are an export the build produces, not something you edit in the project. At build time, Unity generates the files into the project’s Library folder and stages them into StreamingAssets. At runtime, the source reads a table’s file the first time it needs the table and rebuilds it in memory.

The file preserves string values and plain-data entries. Some entries can’t ship in a file: direct object references, and entries flagged Exclude entry from player export. Unity ships these entries in a baked table asset and merges them into the file-built table at load time. The build log lists which tables kept entries in the baked asset.

Test in Play mode

Each data-file source has a Play Mode Source option in its section of the Localization settings. This option controls what Play mode uses:

Value Description
Source assets Serves the live authored tables. This is the default, and changes in the table editor apply immediately.
Generated files Generates the files and reads them the same way a build does. Exercises the real file path without a Player build.

Platform behavior

File reads need direct file access to StreamingAssets. On Android and Web, StreamingAssets is a URL. On these platforms, Localization fetches the files with a web request and skips locale discovery, so you can’t add languages after release this way. Refer to Add a language to a built Player.

Custom file formats

The JSON data-file source consists of scripts to read and write the files, along with a FileTableProvider. To ship tables in your own format instead of JSON, refer to Create a file table provider for text files.

Additional resources

Content sources
Add a language to a built Player