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
Namespace: UnityEngine.AddressableAssets
Syntax
public class AssetReferenceT<TObject> : AssetReference, IKeyEvaluator where TObject : Object
Type Parameters
| Name | Description |
|---|---|
| TObject |
Constructors
AssetReferenceT(String)
Construct a new AssetReference object.
Declaration
public AssetReferenceT(string guid)
Parameters
| Type | Name | Description |
|---|---|---|
| String | guid | The guid of the asset. |
Methods
LoadAsset()
Declaration
public AsyncOperationHandle<TObject> LoadAsset()
Returns
| Type | Description |
|---|---|
| AsyncOperationHandle<TObject> |
LoadAssetAsync()
Declaration
public virtual AsyncOperationHandle<TObject> LoadAssetAsync()
Returns
| Type | Description |
|---|---|
| AsyncOperationHandle<TObject> |
ValidateAsset(Object)
Validates that the referenced asset allowable for this asset reference.
Declaration
public override bool ValidateAsset(Object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | obj | The Object to validate. |
Returns
| Type | Description |
|---|---|
| Boolean | Whether the referenced asset is valid. |
Overrides
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.
Declaration
public override bool ValidateAsset(string mainAssetPath)
Parameters
| Type | Name | Description |
|---|---|---|
| String | mainAssetPath |
Returns
| Type | Description |
|---|---|
| Boolean | Whether the referenced asset is valid. |