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

AssetEntry

class in Unity.Localization

/

Inherits from:Unity.Localization.AssetEntryBase_1

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 asset stored as a direct object reference that ships and loads with the table.

The asset is referenced directly through AssetEntry.DirectAsset, so it is included in the build and resolves without an asynchronous load. Use this kind for assets you want packed with the table, and use ResourceAssetEntry when the asset ships through a Resources folder instead. Add one to a table with ResourceTable.AddEntry.

Additional resources: ResourceAssetEntry, AssetEntryBase<T0>, IAssetEntry, ResourceTable

<para>Add a direct asset entry to a table and check its state.</para>

using Unity.Localization;
using UnityEngine;

namespace Unity.Localization.Samples { public class AssetEntryOverviewExample { public void Run() { var shared = ScriptableObject.CreateInstance<SharedTableData>(); shared.TableCollectionName = "UI Assets";

var table = ScriptableObject.CreateInstance<ResourceTable>(); table.SharedData = shared; table.LocaleIdentifier = new LocaleIdentifier("en");

var entry = new AssetEntry(shared.AddKey("icon").Id); table.AddEntry(entry);

Debug.Log(entry.HasAsset()); // False until DirectAsset is assigned Debug.Log(entry.DirectAsset); // null } } }

Properties

Property Description
DirectAsset The directly referenced asset for this entry.

Constructors

Constructor Description
AssetEntry Creates an empty entry.

Inherited Members

Properties

PropertyDescription
Default The stored reference this entry loads its asset from.

Protected Methods

MethodDescription
HasValue Returns whether the given stored reference holds a value.
Release Releases an asset that was loaded from a stored reference.
TryLoadSync Resolves the asset from the given stored reference synchronously, when the kind supports it.