ドキュメント

Unity Engine

Unity Engine

StringEntry

Represents a localized string entry that stores a single text value with no variants.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

public class StringEntry : ResourceEntryBase, IStringEntry, IResourceEntry

Remarks

This is the built-in IStringEntry kind, holding one locale's text for a key. Add one to a table with ResourceTable.AddStringEntry, which also registers the key in the shared data, or construct one for an existing key id and add it with ResourceTable.AddEntry. Whether the value is treated as a Smart String is a per-key flag on the SharedTableData, not on the entry.
Add a string entry to a table and read its value.

Examples

using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class StringEntryOverviewExample { 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"); Debug.Log(entry.Value); // Hello entry.Value = "Hi"; Debug.Log(entry.Value); // Hi } }}

Constructors

Constructor

Description

StringEntry()Creates an empty entry.
StringEntry(System.Int64,System.String)Creates an entry for a key id.