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

ResourceFolderProvider.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 unload.

Description

Unloads an asset previously loaded from a Resources folder.

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.

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

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