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

ResourceDatabase.GetEntry

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

Declaration

public IResourceEntry GetEntry(TableReference tableRef, TableEntryReference entryRef, Locale locale, bool enableFallback);

Parameters

Parameter Description
tableRef The reference to the table collection that holds the entry.
entryRef The reference to the entry to resolve within the table.
locale The locale to resolve in; null uses the selected locale.
enableFallback Whether to walk the locale fallback chain when the locale has no usable value.

Returns

IResourceEntry The resolved entry, or null when the table is not loaded or no usable value exists.

Description

Resolves an entry synchronously, following the fallback chain, or null when an async load is required.

This is the synchronous companion to ResourceDatabase.GetEntryAsync. It resolves from tables already cached for the locale, and otherwise loads the table through any provider that implements ISynchronousAssetProvider, following the Locale.FallbackCode chain. It returns null when the required table can only be loaded asynchronously and is not already cached.

<para>Reads an entry that is already loaded.</para>

using Unity.Localization;
using UnityEngine;

namespace Unity.Localization.Samples { public class GetEntrySyncExample { public void Run() { IResourceEntry entry = LocalizationSettings.ResourceDatabase.GetEntry("UI Text", "hello"); if (entry is IStringEntry stringEntry) Debug.Log(stringEntry.Value); } } }