docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetBuffer

    GetBuffer<T>(Entity, bool)

    Gets the dynamic buffer of an entity.

    Declaration
    [Obsolete("Use SystemAPI.GetBuffer instead (RemovedAfter Entities 1.0)")]
    public DynamicBuffer<T> GetBuffer<T>(Entity entity, bool isReadOnly = false) where T : unmanaged, IBufferElementData
    Parameters
    Type Name Description
    Entity entity

    The entity.

    bool isReadOnly

    Whether the buffer data is only read or is also written. Access data in a read-only fashion whenever possible.

    Returns
    Type Description
    DynamicBuffer<T>

    The DynamicBuffer object for accessing the buffer contents.

    Type Parameters
    Name Description
    T

    The type of the buffer's elements.

    Remarks

    When you call this method on the main thread, it invokes GetBuffer<T>(Entity, bool). (An [Entities.ForEach] function invoked with Run() executes on the main thread.) When you call this method inside a job scheduled using [Entities.ForEach], this method gets replaced with component access methods through BufferLookup<T>.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if T is an unsupported type.

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