Search Results for

    Show / Hide Table of Contents

    Class OutputExtensions

    Extension methods for AIDevKit types.

    Inheritance
    object
    OutputExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.AIDevKit
    Assembly: Glitch9.AIDevKit.dll
    Syntax
    public static class OutputExtensions

    Methods

    | Edit this page View Source

    GetInputUnityObjects<T>(UserMessage)

    Extracts Unity objects of a specific type from the user message's input files and objects. Useful for displaying images or audio clips sent as part of the message in the UI.

    Declaration
    public static List<T> GetInputUnityObjects<T>(this UserMessage m) where T : Object
    Parameters
    Type Name Description
    UserMessage m

    The user message to extract objects from

    Returns
    Type Description
    List<T>

    A list of Unity objects of type T found in the message, or null if the message is null

    Type Parameters
    Name Description
    T

    The type of Unity object to extract (e.g., Texture2D, AudioClip, Sprite)

    | Edit this page View Source

    ToAudioClip(UniTask<Generated<IAudioAsset>>)

    Awaits the generated audio task and converts the result to an AudioClip.

    Declaration
    public static UniTask<AudioClip> ToAudioClip(this UniTask<Generated<IAudioAsset>> generatedTask)
    Parameters
    Type Name Description
    UniTask<Generated<IAudioAsset>> generatedTask

    The task that will produce a generated collection of IAudioData

    Returns
    Type Description
    UniTask<AudioClip>

    A task that returns the first audio as an AudioClip, or null if not available

    | Edit this page View Source

    ToAudioClip(Generated<IAudioAsset>)

    Converts the first completed audio in the generated collection to an AudioClip.

    Declaration
    public static AudioClip ToAudioClip(this Generated<IAudioAsset> generated)
    Parameters
    Type Name Description
    Generated<IAudioAsset> generated

    The generated collection of IAudioData

    Returns
    Type Description
    AudioClip

    The first completed audio as an AudioClip

    Exceptions
    Type Condition
    InvalidCastException

    Thrown when the audio data is not completed

    | Edit this page View Source

    ToAudioClipAsync(Generated<IAudioAsset>)

    Asynchronously converts the first completed audio in the generated collection to an AudioClip.

    Declaration
    public static UniTask<AudioClip> ToAudioClipAsync(this Generated<IAudioAsset> generated)
    Parameters
    Type Name Description
    Generated<IAudioAsset> generated

    The generated collection of IAudioData

    Returns
    Type Description
    UniTask<AudioClip>

    A task that returns the first completed audio as an AudioClip

    Exceptions
    Type Condition
    InvalidCastException

    Thrown when the audio data is not completed

    | Edit this page View Source

    ToSprite(UniTask<Generated<IImageAsset>>)

    Awaits the generated image task and converts the result to a Sprite.

    Declaration
    public static UniTask<Sprite> ToSprite(this UniTask<Generated<IImageAsset>> generatedTask)
    Parameters
    Type Name Description
    UniTask<Generated<IImageAsset>> generatedTask

    The task that will produce a generated collection of IImageData

    Returns
    Type Description
    UniTask<Sprite>

    A task that returns the first image as a Sprite, or null if not available

    | Edit this page View Source

    ToSprite(Generated<IImageAsset>)

    Converts the first Texture2D in the output to a Sprite, or returns null if not available.

    Declaration
    public static Sprite ToSprite(this Generated<IImageAsset> generated)
    Parameters
    Type Name Description
    Generated<IImageAsset> generated

    The generated collection of Texture2D

    Returns
    Type Description
    Sprite

    The first Texture2D converted to a Sprite, or null if no Texture2D is present.

    | Edit this page View Source

    ToSpriteAsync(Generated<IImageAsset>)

    Asynchronously converts the first image in the generated collection to a Sprite.

    Declaration
    public static UniTask<Sprite> ToSpriteAsync(this Generated<IImageAsset> generated)
    Parameters
    Type Name Description
    Generated<IImageAsset> generated

    The generated collection of IImageData

    Returns
    Type Description
    UniTask<Sprite>

    A task that returns the first image as a Sprite, or null if not available

    | Edit this page View Source

    ToTexture2D(UniTask<Generated<IImageAsset>>)

    Awaits the generated image task and converts the result to a Texture2D.

    Declaration
    public static UniTask<Texture2D> ToTexture2D(this UniTask<Generated<IImageAsset>> generatedTask)
    Parameters
    Type Name Description
    UniTask<Generated<IImageAsset>> generatedTask

    The task that will produce a generated collection of IImageData

    Returns
    Type Description
    UniTask<Texture2D>

    A task that returns the first image as a Texture2D, or null if not available

    | Edit this page View Source

    ToTexture2D(Generated<IImageAsset>)

    Converts the first image in the generated collection to a Texture2D.

    Declaration
    public static Texture2D ToTexture2D(this Generated<IImageAsset> generated)
    Parameters
    Type Name Description
    Generated<IImageAsset> generated

    The generated collection of IImageData

    Returns
    Type Description
    Texture2D

    The first image as a Texture2D, or null if not available

    | Edit this page View Source

    ToTexture2DAsync(Generated<IImageAsset>)

    Asynchronously converts the first image in the generated collection to a Texture2D.

    Declaration
    public static UniTask<Texture2D> ToTexture2DAsync(this Generated<IImageAsset> generated)
    Parameters
    Type Name Description
    Generated<IImageAsset> generated

    The generated collection of IImageData

    Returns
    Type Description
    UniTask<Texture2D>

    A task that returns the first image as a Texture2D, or null if not available

    | Edit this page View Source

    ToUploadRequest(UploadFileRequest)

    Converts an UploadFileRequest to an UploadRequest.

    Declaration
    public static FileUploadRequest ToUploadRequest(this UploadFileRequest req)
    Parameters
    Type Name Description
    UploadFileRequest req

    The UploadFileRequest to convert

    Returns
    Type Description
    FileUploadRequest

    An UploadRequest instance

    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation