Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ResourceEntryBase

Serves as the base class for the built-in resource entry kinds, holding the stable key id and per-entry metadata.
Read time 1 minuteLast updated 6 days ago

Definition

public abstract class ResourceEntryBase : IResourceEntry

Remarks

This class implements the storage that every entry kind shares: the KeyId that ties the entry to a shared key, and the Metadata for that entry. Concrete kinds add their value on top, for example StringEntry for text or AssetEntry for an object reference. Derive from this class (or from AssetEntryBase<TStore>) to add a custom entry kind. Entries are stored polymorphically in a ResourceTable, so a new kind needs no change to the table.
Read the shared members through a concrete string entry.

Examples

using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class ResourceEntryBaseOverviewExample { public void Run() { var shared = ScriptableObject.CreateInstance<SharedTableData>(); shared.TableCollectionName = "UI Text"; var table = ScriptableObject.CreateInstance<ResourceTable>(); table.SharedData = shared; table.LocaleIdentifier = new LocaleIdentifier("en"); StringEntry entry = table.AddStringEntry("greeting", "Hello"); ResourceEntryBase baseEntry = entry; // StringEntry derives from ResourceEntryBase Debug.Log(baseEntry.KeyId); Debug.Log(baseEntry.Metadata.HasData); } }}

Constructors

Constructor

Description

ResourceEntryBase()Creates an empty entry.
ResourceEntryBase(System.Int64)Creates an entry for a key id.