docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ObservationWriterExtension

    Provides extension methods for the ObservationWriter.

    Inheritance
    object
    ObservationWriterExtension
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.MLAgents.Sensors
    Assembly: Unity.ML-Agents.dll
    Syntax
    public static class ObservationWriterExtension

    Methods

    WriteTexture(ObservationWriter, Texture2D, bool)

    Writes a Texture2D into a ObservationWriter.

    Declaration
    public static int WriteTexture(this ObservationWriter obsWriter, Texture2D texture, bool grayScale)
    Parameters
    Type Name Description
    ObservationWriter obsWriter

    Writer to fill with Texture data.

    Texture2D texture

    The texture to be put into the tensor.

    bool grayScale

    If set to true the textures will be converted to grayscale before being stored in the tensor.

    Returns
    Type Description
    int

    The number of floats written

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)