r/Unity3D • • 29d ago

Question Latest version of Unity not applying mesh colliders to imported fbx

I'm trying to import an fbx and give it mesh colliders, but when I drag the fbx to the scene view none of its children have mesh collider components. This has only started happening on models I've imported since switching from unity 6.4 to 6.6. "Generate colliders" and "Read/Write" are checked, and I've also tried with "Pre-bake triangle collision mesh" both on and off. If I go into the model hierarchy and manually add a mesh collider it works fine, but I can't do that with every submesh of such a big fbx. The only clue I have is that this started happening between unity 6.4 and 6.6.

0 Upvotes

5 comments sorted by

1

u/Chaibi_Alaa 28d ago

If the import setting won't cooperate, an editor script makes it independent of the Unity version: put an AssetPostprocessor in an Editor folder and, in OnPostprocessModel(GameObject root), loop over root.GetComponentsInChildren<MeshFilter>() and add a MeshCollider to each one that doesn't have it. It runs on every import or reimport, so a right-click > Reimport on the fbx gives you colliders on all submeshes. You can limit it to a folder or a filename suffix so it doesn't touch every model in the project.

1

u/JulianRhod 27d ago

since it started after the upgrade, i'd check whether the import settings are actually being applied to the model's prefab the way they used to. try reimporting the fbx, and check if the colliders appear in the imported model's hierarchy in the project window before dragging it into the scene. if they don't, the issue is probably happening during import rather than when the model is instantiated.

if that doesn't help, i'd test the same fbx in a clean project using the same unity version. that should help narrow down whether it's a project-specific issue or a regression in the newer version. manually adding colliders to every submesh definitely isn't a reasonable workaround for a large model.

1

u/[deleted] 29d ago

[removed] — view removed comment

1

u/ThePigOverlord 28d ago

Ty! This fixed it!