docs.unity.cn
    Show / Hide Table of Contents

    Method SetBuffer

    SetBuffer<T>()

    Replaces a DynamicBuffer of type T on the primary Entity

    Declaration
    [Obsolete("Use the version of the function with the explicit Entity parameter (RemovedAfter Entities 1.0)")]
    public DynamicBuffer<T> SetBuffer<T>()
        where T : struct, IBufferElementData
    Returns
    Type Description
    DynamicBuffer<T>

    The new DynamicBuffer

    Type Parameters
    Name Description
    T

    The type of buffer to set

    Remarks

    This method can only be invoked if the same baker instance previously added this specific buffer. This is not a very common operation in bakers, but sometimes you have utility methods that add the relevant buffer and initialize them to a reasonable default state for that utility method, but then your baker needs to override the value of one of those added buffers to something specific in your particular baker.

    SetBuffer<T>(Entity)

    Replaces a DynamicBuffer of type T on the Entity

    Declaration
    public DynamicBuffer<T> SetBuffer<T>(Entity entity)
        where T : struct, IBufferElementData
    Parameters
    Type Name Description
    Entity entity

    The Entity to set the buffer on

    Returns
    Type Description
    DynamicBuffer<T>

    The new DynamicBuffer

    Type Parameters
    Name Description
    T

    The type of buffer to set

    Remarks

    This method can only be invoked if the same baker instance previously added this specific buffer. This is not a very common operation in bakers, but sometimes you have utility methods that add the relevant buffer and initialize them to a reasonable default state for that utility method, but then your baker needs to override the value of one of those added buffers to something specific in your particular baker.

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023