Class AddressableAssetTableT<TObject> | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    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.

    Inheritance
    System.Object
    LocalizedTable
    LocalizedAssetTable
    AddressableAssetTableT<TObject>
    AudioClipAssetTable
    SpriteAssetTable
    Texture2DAssetTable
    Inherited Members
    LocalizedTable.LocaleIdentifier
    LocalizedTable.TableName
    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
    IPreloadRequired.PreloadOperation

    SupportedAssetType

    Declaration
    public override Type SupportedAssetType { get; }
    Property Value
    Type Description
    Type
    Overrides
    LocalizedAssetTable.SupportedAssetType

    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
    LocalizedTable.AddKey(String)

    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
    LocalizedTable.GetKeys(HashSet<String>)

    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
    LocalizedTable.RemoveKey(String)

    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
    Overrides
    LocalizedTable.ReplaceKey(String, String)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023