Search Unity

Feedback Mesh API and NativeSlice

Discussion in 'General Graphics' started by arkano22, Jun 17, 2022.

  1. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Hi there!

    I'm working with Jobs and meshes. I can't help but notice that the advanced mesh API exposes functions that take a NativeArray and a start/count range:

    Code (CSharp):
    1.  
    2. SetVertexBufferData(NativeArray<T>, int start, int count, ...);
    3. SetIndexBufferData(NativeArray<T>, int start, int count...)
    https://docs.unity3d.com/ScriptReference/Mesh.SetVertexBufferData.html
    https://docs.unity3d.com/ScriptReference/Mesh.SetIndexBufferData.html

    Wouldn't it make more sense to take a NativeSlice<T> as input? I mean, it covers both the case of passing the entire array as well as a slice of it, and if you have a NativeSlice already there's no need to jump trough hoops to get the array and then the start/count.

    what do you think?