Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Mesh Generation and Disposing of Native Arrays

Discussion in 'Entity Component System' started by borinomemes, Nov 2, 2019.

  1. borinomemes

    borinomemes

    Joined:
    Jun 23, 2019
    Posts:
    2
    I am slightly confused about the life cycle of native arrays that I intend
    to use for meshes with the new Mesh.SetVertexBufferData.
    Should I have a persistent allocation and dispose of said arrays (vertexs, uvs, etc.)
    manually or will they be disposed automatically if the mesh happens to be destroyed?

    Thank you
     
  2. supron

    supron

    Joined:
    Aug 24, 2013
    Posts:
    67
    Mesh has its own memory buffer. You can create temporary native array and dispose it after setting vertex buffer data. All internal vertex buffers are handled by Unity.
     
  3. borinomemes

    borinomemes

    Joined:
    Jun 23, 2019
    Posts:
    2
    Thanks a lot!:)