unity-mcp/UnityMcpBridge
David Sarno 51eb59f04f Fix(MCP): Resolve ValidTRS crash during component serialization
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.
2025-04-10 12:53:01 -07:00
..
Editor Fix(MCP): Resolve ValidTRS crash during component serialization 2025-04-10 12:53:01 -07:00
Runtime Fix: Add missing Runtime assembly and related files 2025-04-10 10:07:20 -07:00
Editor.meta restructured project 2025-04-08 06:14:13 -04:00
Runtime.meta Fix: Add missing Runtime assembly and related files 2025-04-10 10:07:20 -07:00
package.json restructured project 2025-04-08 06:14:13 -04:00
package.json.meta update gitignore 2025-04-08 07:44:46 -04:00