Skip to content

Commit 0b2f764

Browse files
committed
add export setting not to export mesh colliders
1 parent ab5c025 commit 0b2f764

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ public override void OnInspectorGUI() {
5656
exportSettings.autoUpdaterEnabled
5757
);
5858

59+
exportSettings.exportMeshColliders = EditorGUILayout.Toggle(
60+
new GUIContent("Export Mesh Colliders:",
61+
"If unchecked, meshes that don't have renderers won't be exported."),
62+
exportSettings.exportMeshColliders
63+
);
64+
5965
GUILayout.BeginHorizontal();
6066
EditorGUILayout.LabelField(new GUIContent("Export Format:", "Export the FBX file in the standard binary format." +
6167
" Select ASCII to export the FBX file in ASCII format."), GUILayout.Width(LabelWidth - FieldOffset));
@@ -442,6 +448,7 @@ public static string[] DCCVendorLocations
442448
public bool HideSendToUnityMenu = true;
443449
public int ExportFormatSelection;
444450
public bool BakeAnimation = true;
451+
public bool exportMeshColliders = false;
445452

446453
public string IntegrationSavePath;
447454

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3492,6 +3492,13 @@ bool ExportMesh (GameObject gameObject, FbxNode fbxNode)
34923492

34933493
// If we're here, custom handling didn't work.
34943494
// Revert to default handling.
3495+
3496+
// if user doesn't want to export mesh colliders, and this gameobject doesn't have a renderer
3497+
// then don't export it.
3498+
if (!ExportSettings.instance.exportMeshColliders && !gameObject.GetComponent<Renderer>()) {
3499+
return false;
3500+
}
3501+
34953502
var meshFilter = defaultComponent as MeshFilter;
34963503
if (meshFilter) {
34973504
var renderer = gameObject.GetComponent<Renderer>();

0 commit comments

Comments
 (0)