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

StringEntry

class in Unity.Localization

/

Inherits from:Unity.Localization.ResourceEntryBase


Implements interfaces:IResourceEntry, IStringEntry

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

Represents a localized string entry that stores a single text value with no variants.

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.

Additional resources: IStringEntry, ResourceTable, ResourceEntryBase, SharedTableData

<para>Add a string entry to a table and read its value.</para>

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.

Inherited Members