Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Question Mesh.AllocateWritableMeshData allocates what, how much ?

Discussion in '2023.1 Beta' started by equal, Jan 17, 2023.

  1. equal

    equal

    Joined:
    Dec 14, 2012
    Posts:
    77
    Hi,

    im not sure this is the proper section but lets try.

    When generating Meshes we have to use
    "Mesh.MeshDataArray meshDataArray = Mesh.AllocateWritableMeshData(1);"
    this gives us an MeshDataArray
    It containts MeshData.

    Since we define the Vertex and Indice Layout later, the MeshData, MeshDataArray and AllocateWritableMeshData can NOT know how big the Streams or the Data is that we work with or want to work with.

    I read throu:
    https://docs.unity3d.com/2020.1/Documentation/ScriptReference/Mesh.AllocateWritableMeshData.html
    https://docs.unity3d.com/2020.1/Documentation/ScriptReference/Mesh.MeshDataArray.html
    https://docs.unity3d.com/2020.1/Documentation/ScriptReference/Mesh.MeshData.html

    I would like to know, but i cant seem to find the awnsers:
    How big is MeshData in bytes?
    How much "Space" or "Memory" does Mesh.AllocateWritableMeshData allocate by default?
    (Is there a possible systemInfo that i missed?)
     
  2. aras-p

    aras-p

    Joined:
    Feb 17, 2022
    Posts:
    75
    It allocates a really small amount of memory, as far as I remember. Basically N structures for holding eventual mesh data.
     
    mahdi_jeddi likes this.
  3. equal

    equal

    Joined:
    Dec 14, 2012
    Posts:
    77
    Thank you very much, i can work with that