docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IGltfBufferData

    Read access to a glTF asset's buffer data.

    Inherited Members
    IDisposable.Dispose()
    Namespace: Unity.Cloud.Gltfast
    Assembly: Unity.Cloud.Gltfast.dll
    Syntax
    public interface IGltfBufferData : IDisposable
    Remarks

    Buffer data comes with a lease: the import keeps its buffers alive for as long as at least one lease has not been disposed. Dispose it as soon as the data is no longer needed, so the memory can be released.

    Disposing the GltfImport releases the buffers regardless of outstanding leases. Reading afterwards throws ObjectDisposedException.

    Data is provided in glTF's own coordinate system and value range. No conversion, normalization or coordinate flip is applied. Use ComponentType, Type and Normalized to determine how to interpret it.

    Use it from the main thread. The containers it provides may be read from C# jobs and from threads of your own for as long as the lease has not been disposed.

    Methods

    GetAccessorData<T>(int, out ReadOnly)

    Provides an accessor's tightly packed data.

    Declaration
    BufferAccessStatus GetAccessorData<T>(int accessorIndex, out NativeArray<T>.ReadOnly data) where T : unmanaged
    Parameters
    Type Name Description
    int accessorIndex

    glTF accessor index.

    NativeArray<T>.ReadOnly data

    The accessor's elements, if the result is Success.

    Returns
    Type Description
    BufferAccessStatus

    The outcome of the request.

    Type Parameters
    Name Description
    T

    Element type. Its size has to match the accessor's ElementByteSize.

    Remarks

    Only tightly packed data can be provided as a plain array. An accessor whose buffer view declares a byte stride differing from the element size holds interleaved data and is reported as StridedUnsupported; request it via GetStridedAccessorData<T>(int, out ReadOnlyNativeStridedArray<T>) instead.

    GetBufferView(int, out ReadOnly, out int?)

    Provides a buffer view's raw bytes.

    Declaration
    BufferAccessStatus GetBufferView(int bufferViewIndex, out NativeArray<byte>.ReadOnly data, out int? byteStride)
    Parameters
    Type Name Description
    int bufferViewIndex

    glTF buffer view index.

    NativeArray<byte>.ReadOnly data

    The buffer view's bytes, if the result is Success.

    int? byteStride

    The effective byte stride, or null when the data is tightly packed. For compressed buffer views this is the extension's stride, which can differ from ByteStride.

    Returns
    Type Description
    BufferAccessStatus

    The outcome of the request.

    GetStridedAccessorData<T>(int, out ReadOnlyNativeStridedArray<T>)

    Provides an accessor's data as a strided view, which is how interleaved vertex data is laid out.

    Declaration
    BufferAccessStatus GetStridedAccessorData<T>(int accessorIndex, out ReadOnlyNativeStridedArray<T> data) where T : unmanaged
    Parameters
    Type Name Description
    int accessorIndex

    glTF accessor index.

    ReadOnlyNativeStridedArray<T> data

    The accessor's elements, if the result is Success.

    Returns
    Type Description
    BufferAccessStatus

    The outcome of the request.

    Type Parameters
    Name Description
    T

    Element type. Its size has to match the accessor's ElementByteSize.

    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)