Search Unity

Question little help with mesh API (2020.2) please

Discussion in 'Scripting' started by Fenevis, Jan 25, 2021.

  1. Fenevis

    Fenevis

    Joined:
    Jan 21, 2021
    Posts:
    9
    Hi all,

    I've started looking into the new mesh API (because I'm learning JOBS at the same time and meshdata is quite useful)

    I'm used to building a mesh by specifying verts for a cube, then triangles for each face of the cube. I've had some luck ad in cube will render but I'm doign it wrong I feel (as normals and UVs are messed up).

    So I've grab the GetVertexData, add verts for each face, then I've a list of tris i add to so each face gets 6 tris.

    I then GetIndexData() and iterate my triangle list, adding them to that native array.

    This doesn't work.

    I've been over the 2 samples offered in the gitbhub and the "manual" (which builds a tetrahedon).

    I think it's the way I'm handling the GetIndexData and triangles....

    It's been a while (2+ years) since I worked in unity so a little rusty, I'm just porting some old threaded mesh building code to JOBS and burst.. without much joy at the moment.

    Any advice will be appreciated.

    cheers,

    Fen.
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    I'd try asking in the DOTS subforum. The Scripting subforum is mostly MonoBehaviour still, since DOTS is still a janky-ass experimental thing.
     
    Kurt-Dekker and Bunny83 like this.