docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Struct ActionSegment<T>

    ActionSegment{T} is a data structure that allows access to a segment of an underlying array in order to avoid the copying and allocation of sub-arrays. The segment is defined by the offset into the original array, and an length.

    Implements
    IEnumerable<T>
    IEnumerable
    IEquatable<ActionSegment<T>>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.MLAgents.Actuators
    Assembly: solution.dll
    Syntax
    public readonly struct ActionSegment<T> : IEnumerable<T>, IEnumerable, IEquatable<ActionSegment<T>> where T : struct
    Type Parameters
    Name Description
    T

    The type of object stored in the underlying Array

    Constructors

    Name Description
    ActionSegment(T[])

    Construct an ActionSegment<T> with just an actionArray. The Offset will be set to 0 and the Length will be set to actionArray.Length.

    ActionSegment(T[], int, int)

    Construct an ActionSegment<T> with an underlying array and offset, and a length.

    Fields

    Name Description
    Empty

    An Empty segment which has an offset of 0, a Length of 0, and it's underlying array is also empty.

    Length

    The number of items this segment can access in the underlying array.

    Offset

    The zero-based offset into the original array at which this segment starts.

    Properties

    Name Description
    Array

    Get the underlying Array of this segment.

    this[int]

    Allows access to the underlying array using array syntax.

    Methods

    Name Description
    Clear()

    Sets the segment of the backing array to all zeros.

    Equals(object)

    Indicates whether the current ActionSegment is equal to another ActionSegment.

    Equals(ActionSegment<T>)

    Indicates whether the current ActionSegment is equal to another ActionSegment.

    GetEnumerator()

    Returns an enumerator that iterates through the ActionSegment.

    GetHashCode()

    Computes the hash code of the ActionSegment.

    IsEmpty()

    Check if the segment is empty.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023