| Parameter | Description |
|---|---|
| address | The provider-specific address, for example a Resources path. |
| type | The expected asset type. Defaults to Object. |
| subAssetName | The optional name of a sub-asset at the address. |
Creates a key for the given address, interpreted by the active provider.
An empty or null address produces a key whose AssetKey.IsValid is false, which
providers treat as a miss. When type is null, AssetKey.Type reports
Object. Pass subAssetName to target a named sub-asset at the
address, such as one sprite in a sheet.
<para>Create a key for a whole asset and a key for a named sub-asset.</para>
using Unity.Localization.Providers; using UnityEngine;
namespace Unity.Localization.Samples { public class AssetKeyConstructorExample { public void Run() { var icon = new AssetKey("UI/Icons/Settings", typeof(Sprite)); var sheetEntry = new AssetKey("UI/Atlas", typeof(Sprite), "Settings");
Debug.Log(icon.SubAssetName == null); // True Debug.Log(sheetEntry.SubAssetName); // Settings } } }