Fix case-insensitive handling of STL and OBJ file extensions in Unity… #2997
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Unity importer was rejecting uppercase .STL and .OBJ files (commonly used in mujoco_menagerie or unitree_mujoco) due to case-sensitive extension checks. Modified MjImporterWithAssets to use ToLower() when comparing file extensions, allowing both lowercase and uppercase variants.
System Used:
-MacOS 26.2
-Unity 6.3 LTS (6000.3.2f1) | Will work on Unity 2022.3 LTS and later
-MuJoCo 3.4.0 | Unity Plugin 3.4.0
Context:
I'm using the Unity plug-in for a personnel project and research while studying at UdeM. The Mujoco Plugin has no issues when running with Mj Object in the scene. But, while importing scene from major repo. For instance, I tried mujoco_menagerie with the unitree_g1 xml file. Same instance was happening with unitree_mujoco.
In those XML files, the meshes are importing as .STL files. On Mac, which is case-sensitive the files are not processed as binary STL, throwing errors
"Type of mesh file not yet supported. Please convert to binary STL or OBJ. "Fix:
-Added .toLowerInvariant() on line 156, 197 and 201 to fix this instance.
Notes: From my understanding of the contribution guidelines, this is a very simple fix, so I did not push precise test for this update. I made two different tests on two different Mac. If requires I have no problem to added small test on nunit.