docs.unity3d.com
    Show / Hide Table of Contents

    Method CopyFrom

    CopyFrom(NativeArray<T>)

    Copies all the elements from the specified native array into this dynamic buffer.

    Declaration
    public void CopyFrom(NativeArray<T> v)
    Parameters
    Type Name Description
    NativeArray<T> v

    The native array containing the elements to copy.

    Examples
            int[] sourceArray = {1, 2, 3, 4, 5};
            NativeArray<int> nativeArray = new NativeArray<int>(source, Allocator.Persistent);
            buffer.CopyFrom(nativeArray);

    CopyFrom(NativeSlice<T>)

    Copies all the elements from the specified native slice into this dynamic buffer.

    Declaration
    public void CopyFrom(NativeSlice<T> v)
    Parameters
    Type Name Description
    NativeSlice<T> v

    The native slice containing the elements to copy.

    Examples
            NativeSlice<int> nativeSlice = new NativeSlice<int>(nativeArray, 1, 3);
            buffer.CopyFrom(nativeSlice);

    CopyFrom(DynamicBuffer<T>)

    Copies all the elements from another dynamic buffer.

    Declaration
    public void CopyFrom(DynamicBuffer<T> v)
    Parameters
    Type Name Description
    DynamicBuffer<T> v

    The dynamic buffer containing the elements to copy.

    Examples
            buffer.CopyFrom(secondBuffer);

    CopyFrom(T[])

    Copies all the elements from an array.

    Declaration
    public void CopyFrom(T[] v)
    Parameters
    Type Name Description
    T[] v

    A C# array containing the elements to copy.

    Examples
            int[] integerArray = {1, 2, 3, 4, 5};
            buffer.CopyFrom(integerArray);
    Exceptions
    Type Condition
    ArgumentNullException
    Back to top
    Terms of use
    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