文档

Unity Engine

Unity Engine

RemoveEntry(long)

Removes the entry for a stable key id from this table.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
public void RemoveEntry(long keyId)

Parameters

keyId

The stable key id of the entry to remove.

Remarks

Removes only this locale's value. The key stays in ResourceTable.SharedData and the other locale tables keep their entries. Does nothing when no entry matches the id. To drop the key from the whole collection, call SharedTableData.RemoveKey as well.
Remove a single entry and confirm it is gone.

Examples

using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class ResourceTableRemoveEntryExample { public void Run() { var shared = ScriptableObject.CreateInstance<SharedTableData>(); var table = ScriptableObject.CreateInstance<ResourceTable>(); table.SharedData = shared; table.LocaleIdentifier = "en"; var entry = table.AddStringEntry("Greeting", "Hello"); table.RemoveEntry(entry.KeyId); Debug.Log(table.GetEntry(entry.KeyId) == null); // True } }}