Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


HasAsset()

Returns whether this entry has an asset assigned.
Read time 1 minuteLast updated 12 days ago

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 } }}