Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ReleaseAsset(Object)

Releases an asset previously returned by a load.
Read time 1 minuteLast updated 14 days ago

Definition

  • Type: Method
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
void ReleaseAsset(Object asset)

Parameters

asset

The asset to release.

Remarks

Hand every loaded asset back to the same entry so the owning kind can free it. AssetEntry holds a direct reference and does nothing, while ResourceAssetEntry unloads through Resources.
Additional Resources: IAssetEntry.HasAsset()
Release an asset once you are finished with it.

Examples

using Unity.Localization;namespace Unity.Localization.Samples{ public class IAssetEntryReleaseAssetExample { public void Run() { var entry = new ResourceAssetEntry { Default = "UI/banner" }; if (entry.TryLoadAsset(out var asset)) entry.ReleaseAsset(asset); // unload once you are finished with it } }}