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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug MeshUpdateFlags.DontRecalculateBounds is not respected by SetSubMeshes

Discussion in 'Scripting' started by adamgolden, Sep 22, 2022.

  1. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,282
    Per documentation,
    "The bounds, firstVertex and vertexCount values are calculated automatically by Mesh.SetSubMeshes, unless MeshUpdateFlags.DontRecalculateBounds flag is passed."

    This does work for SetSubMesh. However, when using SetSubMeshes, it does not.

    Repro (using a mesh with 1 submesh):
    1. Grab the SubMesh Descriptor from the mesh.
    2. Add a new vertex to the mesh.
    3. Add 1 to the vertexCount property of the submesh.
    4. Use either SetSubMesh or SetSubMeshes (depending on which you're testing) and pass in the DontRecalculateBounds flag.
    5. Grab the SubMesh Descriptor again from the mesh and Debug.Log the vertexCount.

    Tested in 2022.2.0b8, though it seems like something that may have gone unnoticed for a while.