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

ResourceFolderProvider

class in Unity.Localization.Providers


Implements interfaces:IAssetProvider, IAsyncAssetProvider, ISynchronousAssetProvider

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

Description

An asset provider that loads assets from Resources folders, treating the address as a Resources path.

An address that does not resolve to an asset in a Resources folder is a miss and returns null, so addresses meant for other providers do not resolve here. Because this provider always loads by Resources path, a table referenced by collection guid cannot address it directly. Register a guid-address to path alias with ResourceFolderProvider.AddAlias so a guid reference still resolves.

Additional resources: IAssetProvider, AssetProvider, ReferencedAssetProvider, AssetKey

<para>Load an asset from a Resources folder by path.</para>

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

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

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

if (logo != null) Debug.Log(logo.name); } } }

Public Methods

Method Description
AddAlias Maps an address to a Resources path, replacing any existing alias for that address.
LoadAssetAsync Loads the asset for the key from a Resources folder as the requested type.
Release Unloads an asset previously loaded from a Resources folder.
Remove Removes any alias registered under the given address.