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

ISynchronousAssetEntry

interface in Unity.Localization

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

An optional capability for an asset entry that can resolve its asset immediately, without an asynchronous load.

Implement this alongside IAssetEntry when the entry already has its asset in hand, such as a direct object reference or a synchronous Resources load, so LocalizedAsset<T0> can resolve it on the synchronous path (the GetLocalizedAsset accessor, or under the LoadingPreference.Synchronous loading preference). An entry kind that can only load asynchronously (for example an Addressables-backed kind provided by a package) does not implement this interface, and the synchronous path falls back to whatever is already cached.

Additional resources: IAssetEntry, LocalizedAsset<T0>

<para>The built-in asset entries implement this, so a localized asset backed by them resolves synchronously.</para>

using Unity.Localization;
using UnityEngine;

namespace Unity.Localization.Samples { public class SynchronousAssetEntryExample { public Texture Load() { var localizedTexture = new LocalizedTexture(); localizedTexture.SetReference("My Assets", "ICON"); return localizedTexture.GetLocalizedAsset(); } } }

Public Methods

Method Description
TryLoadAsset Tries to resolve the entry's asset without loading asynchronously.