Search Results for

    Show / Hide Table of Contents

    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.

    Namespace: OmiyaGames.Audio
    Assembly: cs.temp.dll.dll
    Syntax
    public struct AssetRef<TObject>
        where TObject : UnityEngine.Object
    Type Parameters
    Name Description
    TObject
    Remarks

    The MIT License (MIT)

    Copyright (c) 2022 Omiya Games

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    RevisionDescription
    Version: 1.0.0
    Date: 6/3/2022
    Author: Taro Omiya
    Initial verison.

    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
    Type Description
    AssetRef<TObject>

    Properties

    Asset

    If Reference is null, gets the referenced project asset.

    If not, and CurrentState is Ready, gets the loaded addressable asset from Reference.

    Otherwise, returns null.

    Declaration
    public TObject Asset { readonly get; }
    Property Value
    Type Description
    TObject

    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
    Type Description
    AssetRef.State

    Name

    Gets the name of the asset, or null if there isn't any.

    Declaration
    public readonly string Name { get; }
    Property Value
    Type Description
    String

    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
    Type Description
    Boolean

    Equals(AssetReferenceT<TObject>)

    Declaration
    public bool Equals(AssetReferenceT<TObject> other)
    Parameters
    Type Name Description
    AssetReferenceT<TObject> other
    Returns
    Type Description
    Boolean

    Equals(AssetRef<TObject>)

    Declaration
    public bool Equals(AssetRef<TObject> other)
    Parameters
    Type Name Description
    AssetRef<TObject> other
    Returns
    Type Description
    Boolean

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32
    Overrides
    ValueType.GetHashCode()

    LoadAssetAsync()

    Starts loading the addressable from Reference.

    Declaration
    public IEnumerator LoadAssetAsync()
    Returns
    Type Description
    IEnumerator

    A coroutine loading the addressable asset.

    ReleaseAsset()

    Unloads the addressable from Reference.

    Declaration
    public void ReleaseAsset()

    Operators

    Implicit(TObject to AssetRef<TObject>)

    Converts to AssetRef<TObject>.

    Declaration
    public static implicit operator AssetRef<TObject>(TObject convert)
    Parameters
    Type Name Description
    TObject convert
    Returns
    Type Description
    AssetRef<TObject>

    Implicit(AssetReferenceT<TObject> to AssetRef<TObject>)

    Converts to AssetRef<TObject>.

    Declaration
    public static implicit operator AssetRef<TObject>(AssetReferenceT<TObject> convert)
    Parameters
    Type Name Description
    AssetReferenceT<TObject> convert
    Returns
    Type Description
    AssetRef<TObject>
    In This Article
    Back to top Copyright © 2022 Omiya Games