Search Unity

Question Can you export MeshCollider mesh with FBX Exporter?

Discussion in 'Asset Importing & Exporting' started by bitinn, Dec 9, 2021.

  1. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Per documentation, "Export Unrendered" option should do this, but it looks like this option only detect a disabled game object or renderer, but not the mesh referenced in the Mesh Collider component.

    I wonder if there is a way for me to export all my generated collider meshes into a single FBX file?

    Appreciate any tips!
     
  2. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    Hi @bitinn,

    The mesh can be exported from Mesh Filter or Skinned Mesh Renderer components. Unfortunately it is not currently possible to export meshes directly from Mesh Collider components.

    Sorry I see how the documentation on "Export Unrendered" is unclear. It was intended as if you have a Mesh Filter and Mesh Collider that uses the Mesh Filter on the same object, "Export Unrendered" would export the Mesh Filter even if there is no renderer.

    In order to export Mesh Colliders, I think the easiest way would be adding a Mesh Filter component that uses the same mesh, then exporting.
     
  3. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Thx for your clarifcation, my use case might be a little different from others, VHACD plugin currently generated many mesh colliders on the same game object. So I was looking for a way to export these mesh assets into a single fbx.

    https://github.com/Unity-Technologies/VHACD

    Not a must for us but nice to have :)
     
  4. vkovec

    vkovec

    Unity Developer - FBX Exporter

    Joined:
    Aug 9, 2017
    Posts:
    257
    ahh I see. Currently only one mesh per object is supported, therefore I think in this case would need to create a GameObject with a MeshFilter per collider and set the MeshFilters to use the same mesh as the colliders. Probably a small script that does this would be the easiest. Then can select all the objects with MeshFilters and export them to the same file.
     
  5. CodyChildress

    CodyChildress

    Joined:
    Mar 18, 2016
    Posts:
    2
    Hey bitinn, did you end up writing the small script the vkovec is suggesting here? I am looking for this functionality too :D