Search Unity

Question Mesh changes during export to assetbundle

Discussion in 'Asset Bundles' started by billykater, Oct 5, 2022.

  1. billykater

    billykater

    Joined:
    Mar 12, 2011
    Posts:
    329
    We are currently hunting a curious bug where a mesh apparently slightly changes its vertex coordinates (seems like it truncates the floats) when exported to an assetbundle. Unity 2021.3.5f1

    The setup:
    Two meshes which fit together nicely without any seams. See runtime_editor.jpg

    After exporting the scene these are contained into an assetbundle there seem to be apparent gaps between the meshes. See runtime_assetbundle.jpg

    Investigation:
    • Position of the bottom model doesn't change adding some random cubes as markers shows that seemingly only the top mesh changes position
    • Both transforms are exactly at the same position they are in the editor.
    • Loading the assetbundle scene inside the editor allows us to swap the top mesh in the meshfilter with the original from the editor. Everything looks fine after setting the editor mesh so the mesh data itself seems to change when being exported to an assetbundle.
    • Writing a small mesh compare tool we can see that nearly all vertices have a small amount of vertex displacement in seemingly random directions. See mesh_data_compare.png (A is the assetbundle mesh, B is the editor mesh which the assetbundle is built from). Nearly all vertex coordinates in A seem to be missing some of their least significant bits.
    • Putting both of these meshes in a small project for reproduction doesn't seem to exhibit the same behaviour.
    • No other mesh in this (rather big) project currently seem to exhibit this behaviour.

    Has anyone had a similar experience or any idea why this only happens to exactly one mesh in the whole project.
    If anyone has idea on how to track where this issue is coming from I would appreciate any pointers.
     

    Attached Files:

  2. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    391