Class AddressableAssetTableT<TObject>
Maps asset guid to key for a selected Locale. The asset must also be managed by the Addressables system for it to be loaded at runtime.
Namespace: UnityEngine.Localization
Syntax
public class AddressableAssetTableT<TObject> : LocalizedAssetTable, IPreloadRequired, ISerializationCallbackReceiver where TObject : Object
Type Parameters
Name | Description |
---|---|
TObject | The type of Asset being localized. For example Texture2D, AudioClip, Prefab etc. |
Properties
AssetMap
The internal map used to reference assets by key.
Declaration
public Dictionary<string, AssetTableItemData> AssetMap { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<System.String, AssetTableItemData> |
PreloadOperation
TODO: DOC
Declaration
public IAsyncOperation PreloadOperation { get; }
Property Value
Type | Description |
---|---|
IAsyncOperation |
Implements
SupportedAssetType
Declaration
public override Type SupportedAssetType { get; }
Property Value
Type | Description |
---|---|
Type |
Overrides
Methods
AddAsset(String, String)
Maps the asset to the key for this LocaleId.
Declaration
public virtual void AddAsset(string assetKey, string assetGuid)
Parameters
Type | Name | Description |
---|---|---|
System.String | assetKey | The key to map the asset to. |
System.String | assetGuid | The guid of the asset. The asset will also need to be controlled by the Addressables system to be found. |
AddKey(String)
Add a new key to the table. Must be unique or it will be ignored.
Declaration
public override void AddKey(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Overrides
GetAsset(String)
Synchronous version of GetAssetAsync. The table and its assets must have been preloaded to use this. See See PreloadBehavior.
Declaration
public TObject GetAsset(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
TObject |
GetAssetAsync(String)
Returns the loading operation for the asset. Check isDone to see if the asset is available for immediate use, if not you can yield on the operation or add a callback subscriber.
Declaration
public IAsyncOperation<TObject> GetAssetAsync(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Returns
Type | Description |
---|---|
IAsyncOperation<TObject> |
GetGuidFromKey(String)
Returns the asset guid for a specific key.
Declaration
public string GetGuidFromKey(string assetKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | assetKey |
Returns
Type | Description |
---|---|
System.String | guid or string.Empty if it was not found. |
GetKeys(HashSet<String>)
Populate the HashSet with all keys in this table. Allows us to collate the keys from multiple locale for the same table name.
Declaration
public override void GetKeys(HashSet<string> keySet)
Parameters
Type | Name | Description |
---|---|---|
HashSet<System.String> | keySet |
Overrides
LoadAllAssets()
Force the table to load all assets(if they are not already loading or loaded.
Declaration
public virtual void LoadAllAssets()
OnAfterDeserialize()
Declaration
public virtual void OnAfterDeserialize()
OnBeforeSerialize()
Declaration
public virtual void OnBeforeSerialize()
RemoveKey(String)
Remove the key if it exists.
Declaration
public override void RemoveKey(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key |
Overrides
ReplaceKey(String, String)
Replace the old key value with the newKey value.
Declaration
public override void ReplaceKey(string key, string newKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | |
System.String | newKey |