AssetKey
struct in
Unity.Localization.Providers
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
Description
Identifies a single asset to load through an asset provider. The key pairs a provider specific address with an
expected asset type, and optionally the name of a sub-asset at that address.
using Unity.Localization.Providers;
using UnityEngine;
namespace Unity.Localization.Samples
{
public class AssetKeyOverviewExample
{
public void Run()
{
var key = new AssetKey("UI/Flags/Fr", typeof(Texture2D));
Debug.Log(key.Address); // UI/Flags/Fr
Debug.Log(key.Type.Name); // Texture2D
Debug.Log(key.IsValid); // True
}
}
}
Properties
| Property |
Description |
| Address |
The provider-specific address that identifies the asset.
|
| IsValid |
Whether this key carries an address.
|
| SubAssetName |
The name of the sub-asset at the address, or null when the key targets the whole asset.
|
| Type |
The expected asset type.
|
Constructors
| Constructor |
Description |
| AssetKey |
Creates a key for the given address, interpreted by the active provider.
|
Public Methods
| Method |
Description |
| Equals |
Checks whether this key identifies the same asset as another.
|
| GetHashCode |
Computes a hash code for this key.
|
| ToString |
Returns a readable string describing this key.
|
Operators
| Operator |
Description |
| operator != |
Compares two keys for inequality.
|
| operator == |
Compares two keys for equality.
|