Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

IFileDataEntry

interface in Unity.Localization


Implements interfaces:IResourceEntry

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

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.

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.

Additional resources: IResourceEntry, ResourceAssetEntry, AssetEntry

<para>Check whether an entry can be exported to a localization data file.</para>

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 } } }