docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class AssetReferenceT<TObject>

    Generic version of AssetReference class. This should not be used directly as CustomPropertyDrawers do not support generic types. Instead use the concrete derived classes such as AssetReferenceGameObject.

    Inheritance
    object
    AssetReference
    AssetReferenceT<TObject>
    AssetReferenceAtlasedSprite
    AssetReferenceGameObject
    AssetReferenceSprite
    AssetReferenceTexture
    AssetReferenceTexture2D
    AssetReferenceTexture3D
    Implements
    IKeyEvaluator
    Inherited Members
    AssetReference.m_AssetGUID
    AssetReference.OperationHandle
    AssetReference.RuntimeKey
    AssetReference.AssetGUID
    AssetReference.SubObjectName
    AssetReference.SubObjectGUID
    AssetReference.IsValid()
    AssetReference.IsDone
    AssetReference.Asset
    AssetReference.CachedAsset
    AssetReference.ToString()
    AssetReference.LoadAssetAsync<TObject>()
    AssetReference.LoadSceneAsync(LoadSceneMode, bool, int)
    AssetReference.UnLoadScene()
    AssetReference.InstantiateAsync(Vector3, Quaternion, Transform)
    AssetReference.InstantiateAsync(Transform, bool)
    AssetReference.RuntimeKeyIsValid()
    AssetReference.ReleaseAsset()
    AssetReference.ReleaseInstance(GameObject)
    AssetReference.SetEditorAsset(Object)
    AssetReference.SetEditorSubObject(Object)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.AddressableAssets
    Assembly: Unity.Addressables.dll
    Syntax
    [Serializable]
    public class AssetReferenceT<TObject> : AssetReference, IKeyEvaluator where TObject : Object
    Type Parameters
    Name Description
    TObject

    The type of object to use with this AssetReference

    Constructors

    Name Description
    AssetReferenceT(string)

    Construct a new AssetReference object.

    Properties

    Name Description
    DerivedClassType
    editorAsset

    Type-specific override of parent editorAsset. Used by the editor to represent the main asset referenced.

    Methods

    Name Description
    LoadAssetAsync()

    Load the referenced asset as type TObject. This cannot be used a second time until the first load is released. If you wish to call load multiple times on an AssetReference, use LoadAssetAsync<TObject>(object) and pass your AssetReference in as the key. on an AssetReference, use Addressables.LoadAssetAsync<>() and pass your AssetReference in as the key.

    See the Loading Addressable Assets documentation for more details.

    ValidateAsset(string)

    Validates that the asset located at a path is allowable for this asset reference. An asset is allowable if it is of the correct type or if one of its sub-asset is.

    ValidateAsset(Object)

    Validates that the referenced asset allowable for this asset reference.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)