ドキュメント

Unity Engine

Unity Engine

HasAsset()

Returns whether this entry has an asset assigned.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
bool HasAsset()

Returns

Type

Description

bool
true
when an asset is assigned; otherwise,
false
.

Remarks

Tests the stored reference without loading anything, so it is cheap to call before resolving the asset.
Additional Resources: IAssetEntry.ReleaseAsset
Skip the load when the entry has no asset.

Examples

using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class IAssetEntryHasAssetExample { public void Run() { var entry = new ResourceAssetEntry(); Debug.Log(entry.HasAsset()); // False: no path set entry.Default = "UI/banner"; // a path under a Resources folder Debug.Log(entry.HasAsset()); // True } }}