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

ResourceAssetEntry

class in Unity.Localization

/

Inherits from:Unity.Localization.AssetEntryBase_1


Implements interfaces:IFileDataEntry, IResourceEntry

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 path into a Resources folder.

The entry keeps only the Resources path in AssetEntryBase<T0>.Default, and the asset ships through its Resources folder rather than as a direct reference, so nothing extra is packed with the table. The asset is resolved on demand with Resources.Load and unloaded by AssetEntryBase<T0>.ReleaseAsset. Use AssetEntry instead when you want a direct reference packed with the table.

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

<para>Add a Resources-backed asset entry and confirm it has a path.</para>

using Unity.Localization;
using UnityEngine;

namespace Unity.Localization.Samples { public class ResourceAssetEntryOverviewExample { 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 ResourceAssetEntry(shared.AddKey("music").Id); entry.Default = "Audio/theme"; // a path under a Resources folder table.AddEntry(entry);

Debug.Log(entry.HasAsset()); // True: a path is set } } }

Constructors

Constructor Description
ResourceAssetEntry 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.