AssetKey(string, Type, string)
Creates a key for the given address, interpreted by the active provider.
Read time 1 minuteLast updated 16 days ago
Definition
- Type: Constructor
- Namespace: Unity.Localization.Providers
- Assembly: UnityEngine.LocalizationRuntimeModule
public AssetKey(string address, Type type = null, string subAssetName = null)
Parameters
Remarks
An empty or null produces a key whose AssetKey.IsValid is , which providers treat as a miss. When is , AssetKey.Type reports Object. Pass to target a named sub-asset at the address, such as one sprite in a sheet.
addressfalsetypenullsubAssetNameCreate a key for a whole asset and a key for a named sub-asset.
Examples
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 } }}