Add support for creating physics material assets. Works on Unity 2022 onwards and Unity 6, since they use different naming for PhysicsMaterial(PhysicMaterial before Unity 6, and PhysicsMaterial after).
Add naming examples on the server side
TODO: currently unity-mcp only support adding gameobject and specifying adding a physic material, and manage_gameobject.cs does not handle a detailed request such as the copied request well. Will be the future work.
Example:
{
`name`: `BouncyCube`,
`action`: `create`,
`position`: [
6,
2,
0
],
`primitive_type`: `Cube`,
`components_to_add`: [
`Rigidbody`
],
`component_properties`: {
`Rigidbody`: {
`mass`: 1,
`useGravity`: true
},
`BoxCollider`: {
`material`: `Assets/Physics Materials/SuperBouncePhysicsMaterial.physicmaterial`
}
}
}
1. Solve the IDE/Unity miscommunication for the _Color and menuPath params
2. TODOs: Fix readme, look into more issues, bring back tool dev tutorial, view pull request and set a future roadmap
- Updated McpTypes to include VSCode.
- Enhanced McpClients to handle VSCode configuration paths.
- Implemented VSCodeManualSetupWindow for user instructions and JSON configuration.
- Modified UnityMcpEditorWindow to support VSCode-specific setup and configuration.
- Updated .gitignore to include .DS_Store files.
- Add get_components to the list of available actions in the docstring
- Document required and optional parameters for get_components action
- Clarify the return value structure for get_components
- Improve overall documentation clarity for component data retrieval
The Unity Editor was crashing with ValidTRS() assertions when attempting to get components from certain GameObjects like the Main Camera.
Investigation revealed the crash occurred during JSON serialization when reflection code accessed specific matrix properties (e.g., Camera.cullingMatrix, Transform.rotation, Transform.lossyScale). Accessing these properties appears to trigger internal Transform state validation failures, potentially due to interactions with the JSON serializer's reflection mechanism.
This fix addresses the issue by:
- Replacing LINQ iteration in GetComponentsFromTarget with a standard loop over a copied list to prevent potential premature serialization interactions.
- Explicitly skipping known problematic Camera matrix properties (cullingMatrix, pixelRect, rect) and generic matrix properties (worldToLocalMatrix, localToWorldMatrix) within GetComponentData's reflection logic.
- Retaining manual serialization for Transform component properties to avoid related reflection issues.
Moved serialization logic (GetGameObjectData, GetComponentData, metadata caching, JSON conversion helpers) from ManageGameObject tool to a dedicated GameObjectSerializer class in the Helpers namespace.
This improves separation of concerns and reduces the size/complexity of ManageGameObject.cs. Updated ManageGameObject to use the new helper class.