Struct AssetRef<TObject>
A common wrapper to an asset. Use this to represent Assets that could
either be a direct reference to a project asset, or an
addressable reference.
Assembly: cs.temp.dll.dll
Syntax
public struct AssetRef<TObject>
where TObject : UnityEngine.Object
Type Parameters
Constructors
AssetRef(TObject)
Creates a wrapper for a project asset.
Should not be used for addressable assets.
Declaration
public AssetRef(TObject asset)
Parameters
Type |
Name |
Description |
TObject |
asset |
The project asset.
|
AssetRef(AssetReferenceT<TObject>)
Creates a wrapper for an addressable asset.
Declaration
public AssetRef(AssetReferenceT<TObject> reference)
Parameters
Type |
Name |
Description |
AssetReferenceT<TObject> |
reference |
The addressable asset.
|
Fields
NULL
Declaration
public static readonly AssetRef<TObject> NULL
Field Value
Properties
Asset
Declaration
public TObject Asset { readonly get; }
Property Value
CurrentState
Indicates whether this object is null, project asset (ProjectAsset),
or whether Reference has loaded or unloaded an asset.
Declaration
public readonly AssetRef.State CurrentState { get; }
Property Value
Name
Gets the name of the asset, or null
if there isn't any.
Declaration
public readonly string Name { get; }
Property Value
Reference
Gets the addressable asset's reference, if constructed
by
Declaration
public readonly AssetReferenceT<TObject> Reference { get; }
Property Value
Type |
Description |
AssetReferenceT<TObject> |
|
Methods
Equals(TObject)
Declaration
public bool Equals(TObject other)
Parameters
Type |
Name |
Description |
TObject |
other |
|
Returns
Equals(AssetReferenceT<TObject>)
Declaration
public bool Equals(AssetReferenceT<TObject> other)
Parameters
Type |
Name |
Description |
AssetReferenceT<TObject> |
other |
|
Returns
Equals(AssetRef<TObject>)
Declaration
public bool Equals(AssetRef<TObject> other)
Parameters
Type |
Name |
Description |
AssetRef<TObject> |
other |
|
Returns
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
LoadAssetAsync()
Starts loading the addressable from Reference.
Declaration
public IEnumerator LoadAssetAsync()
Returns
Type |
Description |
IEnumerator |
A coroutine loading the addressable asset.
|
ReleaseAsset()
Declaration
public void ReleaseAsset()
Operators
Implicit(TObject to AssetRef<TObject>)
Declaration
public static implicit operator AssetRef<TObject>(TObject convert)
Parameters
Type |
Name |
Description |
TObject |
convert |
|
Returns
Implicit(AssetReferenceT<TObject> to AssetRef<TObject>)
Declaration
public static implicit operator AssetRef<TObject>(AssetReferenceT<TObject> convert)
Parameters
Type |
Name |
Description |
AssetReferenceT<TObject> |
convert |
|
Returns