Release(Object)
Unloads an asset previously loaded from a Resources folder.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: Unity.Localization.Providers
- Assembly: UnityEngine.LocalizationRuntimeModule
public void Release(Object asset)
Parameters
The asset to unload.
Remarks
Releases the Resources reference so the asset can be unloaded when nothing else uses it. Pass an asset returned by one of the load methods.
Release a loaded asset once it is no longer needed.
Examples
using System.Threading;using Unity.Localization.Providers;using UnityEngine;namespace Unity.Localization.Samples{ public class ResourceFolderProviderReleaseExample { public async Awaitable Run() { var provider = new ResourceFolderProvider(); var icon = await provider.LoadAssetAsync<Sprite>( new AssetKey("UI/Icons/Settings", typeof(Sprite)), CancellationToken.None); if (icon != null) provider.Release(icon); } }}