How to use meshes with more than 64k vertices in Unity 2018.1

前端 未结 1 1515
攒了一身酷
攒了一身酷 2021-01-04 08:30

I\'ve heard that Unity supports 32-bit index buffer now. But when I try Unity 2018.1 I can\'t make it work.

I built meshes in code like this:

    int         


        
相关标签:
1条回答
  • 2021-01-04 08:54

    Mesh buffers are 16 bit by default. See Mesh-indexFormat:

    Index buffer can either be 16 bit (supports up to 65535 vertices in a mesh), or 32 bit (supports up to 4 billion vertices). Default index format is 16 bit, since that takes less memory and bandwidth.

    Without looking too closely at the rest of your code, I do note that you've not set a 32 bit buffer. Try:

    mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
    
    0 讨论(0)
提交回复
热议问题