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

IAssetProvider.Release

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

Declaration

public void Release(Object asset);

Parameters

Parameter Description
asset The asset to release.

Description

Releases an asset previously returned by this provider.

Call this when the asset is no longer needed so the provider can unload it. Providers that hand back assets they do not own, such as ReferencedAssetProvider, implement this as a no-op.

<para>Release an asset once it is no longer needed.</para>

using System.Threading;
using Unity.Localization.Providers;
using UnityEngine;

namespace Unity.Localization.Samples { public class IAssetProviderReleaseExample { public async Awaitable Run() { IAsyncAssetProvider provider = new ResourceFolderProvider();

var texture = await provider.LoadAssetAsync<Texture2D>( new AssetKey("UI/Logo", typeof(Texture2D)), CancellationToken.None);

if (texture != null) provider.Release(texture); } } }