Class AssetReferenceT<TObject> | Package Manager UI website
docs.unity3d.com
    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
    System.Object
    AssetReference
    AssetReferenceT<TObject>
    AssetReferenceGameObject
    AssetReferenceSprite
    AssetReferenceTexture
    AssetReferenceTexture2D
    AssetReferenceTexture3D
    Inherited Members
    AssetReference.RuntimeKey
    AssetReference.Asset
    AssetReference.ToString()
    AssetReference.LoadAsset<TObject>()
    AssetReference.Instantiate<TObject>(Vector3, Quaternion, Transform)
    AssetReference.Instantiate<TObject>(Transform, Boolean)
    AssetReference.ReleaseAsset<TObject>(Object)
    AssetReference.ReleaseAsset<TObject>()
    AssetReference.ReleaseInstance<TObject>(TObject)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: UnityEngine.AddressableAssets
    Syntax
    public class AssetReferenceT<TObject> : AssetReference where TObject : Object
    Type Parameters
    Name Description
    TObject

    Methods

    Instantiate(Transform, Boolean)

    Instantiate the referenced asset as type TObject.

    Declaration
    public IAsyncOperation<TObject> Instantiate(Transform parent = null, bool instantiateInWorldSpace = false)
    Parameters
    Type Name Description
    Transform parent

    The parent transform of the instantiated object.

    System.Boolean instantiateInWorldSpace

    Option to retain world space when instantiated with a parent.

    Returns
    Type Description
    IAsyncOperation<TObject>

    Instantiate(Vector3, Quaternion, Transform)

    Instantiate the referenced asset as type TObject.

    Declaration
    public IAsyncOperation<TObject> Instantiate(Vector3 position, Quaternion rotation, Transform parent = null)
    Parameters
    Type Name Description
    Vector3 position

    The position of the instantiated object.

    Quaternion rotation

    The rotation of the instantiated object.

    Transform parent

    The parent transformation of the instantiated object.

    Returns
    Type Description
    IAsyncOperation<TObject>

    LoadAsset()

    Load the referenced asset as type TObject.

    Declaration
    public IAsyncOperation<TObject> LoadAsset()
    Returns
    Type Description
    IAsyncOperation<TObject>

    The load operation.

    ValidateType(Type)

    Ensure that the referenced asset is of the correct type.

    Declaration
    public override bool ValidateType(Type type)
    Parameters
    Type Name Description
    System.Type type

    The type to validate.

    Returns
    Type Description
    System.Boolean
    Overrides
    AssetReference.ValidateType(Type)
    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