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

Physics.BakeMesh Save Mesh Asset

Discussion in 'Physics' started by MylesLambert, Apr 20, 2022.

  1. MylesLambert

    MylesLambert

    Joined:
    Dec 31, 2012
    Posts:
    61
    Hello!
    According to the documentation for Physics.BakeMesh the result is saved into the mesh itself. However it doesn't seem possible to serialize this into the mesh asset. My test for this is quite simple,

    Code (CSharp):
    1. Physics.BakeMesh(mesh.GetInstanceID(), false);
    2. AssetDatabase.CreateAsset(mesh, "Assets/TestMesh.asset");
    If I then check the asset I can see that m_BakedTriangleCollisionMesh has not been set.
    Is this intended behaviour? I had hoped to use this method to pre-bake collision meshes.
     
  2. MylesLambert

    MylesLambert

    Joined:
    Dec 31, 2012
    Posts:
    61
    Bump! Is there anyway to save baked physics meshes other than using Pre-Baked Collision option?