docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Accessor

    An accessor defines a method for retrieving data as typed arrays from within a buffer view. See . accessor in the glTF 2.0 specification.

    Inheritance
    object
    NamedObject
    Accessor
    Inherited Members
    NamedObject.Name
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Cloud.Gltfast.Objects
    Assembly: Unity.Cloud.Gltfast.dll
    Syntax
    [MovedFrom(true, "GLTFast.Schema", "glTFast", null)]
    public class Accessor : NamedObject

    Properties

    AdditionalProperties

    Additional properties on glTF JSON objects. Those properties may have been added by a new, unsupported version of the glTF specification. For extending glTF, please use extensions or extras instead.

    Declaration
    [JsonIgnore]
    public ReadOnlyProperties AdditionalProperties { get; }
    Property Value
    Type Description
    ReadOnlyProperties

    BufferView

    The index of the bufferView. If this is undefined, look in the sparse object for the index and value buffer views.

    Declaration
    [JsonPropertyName("bufferView")]
    public int? BufferView { get; set; }
    Property Value
    Type Description
    int?

    ByteOffset

    The offset relative to the start of the bufferView in bytes. This must be a multiple of the size of the component datatype.

    Declaration
    [JsonPropertyName("byteOffset")]
    public int ByteOffset { get; set; }
    Property Value
    Type Description
    int

    ByteSize

    Overall, byte size. Ignores interleaved or sparse accessors

    Declaration
    [JsonIgnore]
    public int ByteSize { get; }
    Property Value
    Type Description
    int

    ComponentType

    The datatype of components in the attribute. All valid values correspond to WebGL enums. The corresponding typed arrays are: Int8Array, Uint8Array, Int16Array, Uint16Array, Uint32Array, and Float32Array, respectively. 5125 (UNSIGNED_INT) is only allowed when the accessor contains indices i.e., the accessor is only referenced by primitive.indices.

    Declaration
    [JsonPropertyName("componentType")]
    public AccessorDataType ComponentType { get; set; }
    Property Value
    Type Description
    AccessorDataType

    Count

    The number of attributes referenced by this accessor, not to be confused with the number of bytes or number of components.

    Declaration
    [JsonPropertyName("count")]
    public int Count { get; set; }
    Property Value
    Type Description
    int

    ElementByteSize

    Byte size of one element

    Declaration
    [JsonIgnore]
    public int ElementByteSize { get; }
    Property Value
    Type Description
    int

    Extensions

    JSON object with extension-specific objects.

    Declaration
    [JsonPropertyName("extensions")]
    public AccessorExtensions Extensions { get; set; }
    Property Value
    Type Description
    AccessorExtensions
    See Also
    https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extension

    Extras

    Application-specific data.

    Declaration
    [JsonPropertyName("extras")]
    [JsonConverter(typeof(ExtrasConverter))]
    public ExtrasContainer Extras { get; set; }
    Property Value
    Type Description
    ExtrasContainer
    See Also
    https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras

    IsSparse

    True if the accessor is sparse

    Declaration
    [JsonIgnore]
    public bool IsSparse { get; }
    Property Value
    Type Description
    bool

    Max

    Maximum value of each component in this attribute. Both min and max arrays have the same length. The length is determined by the value of the type property; it can be 1, 2, 3, 4, 9, or 16.

    When componentType is 5126 (FLOAT) each array value must be stored as double-precision JSON number with numerical value which is equal to buffer-stored single-precision value to avoid extra runtime conversions.

    normalized property has no effect on array values: they always correspond to the actual values stored in the buffer. When accessor is sparse, this property must contain max values of accessor data with sparse substitution applied.

    Declaration
    [JsonPropertyName("max")]
    [JsonConverter(typeof(DoubleListConverter))]
    public List<double> Max { get; set; }
    Property Value
    Type Description
    List<double>

    Min

    Minimum value of each component in this attribute. Both min and max arrays have the same length. The length is determined by the value of the type property; it can be 1, 2, 3, 4, 9, or 16.

    When componentType is 5126 (FLOAT) each array value must be stored as double-precision JSON number with numerical value which is equal to buffer-stored single-precision value to avoid extra runtime conversions.

    normalized property has no effect on array values: they always correspond to the actual values stored in the buffer. When accessor is sparse, this property must contain min values of accessor data with sparse substitution applied.

    Declaration
    [JsonPropertyName("min")]
    [JsonConverter(typeof(DoubleListConverter))]
    public List<double> Min { get; set; }
    Property Value
    Type Description
    List<double>

    Normalized

    Specifies whether integer data values should be normalized (true) to [0, 1] (for unsigned types) or [-1, 1] (for signed types), or converted directly (false) when they are accessed. Must be false when accessor is used for animation data.

    Declaration
    [JsonPropertyName("normalized")]
    public bool Normalized { get; set; }
    Property Value
    Type Description
    bool

    Sparse

    Sparse storage of attributes that deviate from their initialization value.

    Declaration
    [JsonPropertyName("sparse")]
    public AccessorSparse Sparse { get; set; }
    Property Value
    Type Description
    AccessorSparse

    Type

    Specifies if the accessor’s elements are scalars, vectors, or matrices.

    Declaration
    [JsonPropertyName("type")]
    [JsonConverter(typeof(AccessorTypeValueConverter))]
    public EnumOrRawValue<AccessorType> Type { get; set; }
    Property Value
    Type Description
    EnumOrRawValue<AccessorType>
    See Also
    https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#_accessor_type

    Methods

    GetAccessorAttributeType(int)

    Get one-dimensional glTF attribute type by number of components per elements. Note that this does not support matrix types.

    Declaration
    public static AccessorType GetAccessorAttributeType(int dimension)
    Parameters
    Type Name Description
    int dimension

    Number of components per element

    Returns
    Type Description
    AccessorType

    Corresponding one-dimensional glTF attribute type

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown when dimension is not between 1 and 4.

    GetAccessorAttributeTypeLength(AccessorType)

    Get number of components of glTF attribute type.

    Declaration
    public static int GetAccessorAttributeTypeLength(AccessorType type)
    Parameters
    Type Name Description
    AccessorType type

    glTF attribute type

    Returns
    Type Description
    int

    Number of components

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown when the value of type is unknown.

    GetComponentType(VertexAttributeFormat)

    Converts Unity vertex attribute format to glTF component type.

    Declaration
    public static AccessorDataType GetComponentType(VertexAttributeFormat format)
    Parameters
    Type Name Description
    VertexAttributeFormat format

    vertex attribute format

    Returns
    Type Description
    AccessorDataType

    glTF component type

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown when the value of format is unknown.

    GetComponentTypeSize(AccessorDataType)

    Provides size of components by type

    Declaration
    public static int GetComponentTypeSize(AccessorDataType componentType)
    Parameters
    Type Name Description
    AccessorDataType componentType

    glTF component type

    Returns
    Type Description
    int

    Component size in bytes

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown when value of ComponentType is unknown

    TryGetBounds()

    For 3D positional data, returns accessor's bounding box. Applies coordinate system transform (glTF to Unity)

    Declaration
    public Bounds? TryGetBounds()
    Returns
    Type Description
    Bounds?

    Bounding box enclosing the minimum and maximum values

    In This Article
    Back to top
    Copyright © 2026 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)