IFileDataEntry
Marks a resource entry whose stored value is plain data that round-trips through JSON, so a file-backed table provider can export it to a data file and rebuild it at runtime without shipping the authored table asset.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Interface
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
public interface IFileDataEntry : IResourceEntry
Remarks
An entry that implements this interface serializes losslessly through JsonUtility: it holds no Object references, and whatever it points at is reachable in a player on its own, such as a Resources path or an Addressables address supplied by a package. A file-backed provider writes these entries into its data files; a table whose entries do not all satisfy this contract keeps its asset in the build so the remaining references survive. Per-entry IResourceEntry.Metadata does not round-trip through file data. ResourceAssetEntry implements this because it stores a Resources path, while AssetEntry does not, because it holds a direct object reference.
Check whether an entry can be exported to a localization data file.
Examples
using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class IFileDataEntryOverviewExample { public void Run() { IResourceEntry resourceEntry = new ResourceAssetEntry(1) { Default = "Icons/Flag" }; IResourceEntry directEntry = new AssetEntry(2); Debug.Log(resourceEntry is IFileDataEntry); // True: stores a Resources path Debug.Log(directEntry is IFileDataEntry); // False: holds a direct object reference } }}