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.
Inherited Members
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
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 |