unity-mcp/MCPForUnity/Editor/Helpers
dsarno f4d62e4da0
Fix material mesh instantiation warnings (#331)
* Editor: prevent material/mesh instantiation in edit mode

- GameObjectSerializer: in edit mode, normalize material/mesh access
  - material -> sharedMaterial
  - materials -> sharedMaterials
  - mesh -> sharedMesh
  - also guard materials/sharedMaterial/sharedMaterials property names
- Tests: add strong instanceID equality checks for Renderer/MeshFilter
  - prove no instantiation by shared instanceID before/after
  - cover multi-material, null cases; prune brittle presence/console tests
- Clean up and relax ManageGameObject tests to avoid false negatives

* Address review: simplify edit-mode guard; include protected/internal [SerializeField]; fix tests to destroy temp primitives and use dictionary access; strengthen instanceID assertions

* Fix resource leaks in test files

- ManageGameObjectTests.cs: Destroy temporary primitive GameObject after extracting sharedMesh
- MaterialMeshInstantiationTests.cs: Destroy instantiated uniqueMesh after test completion

These fixes prevent resource leaks in Unity test files by properly cleaning up temporary objects created during tests.

* Fix reflection bug in GetComponentData tests

- Replace incorrect reflection-based field access with proper dictionary key access
- GetComponentData() returns Dictionary<string, object> where 'properties' is a key, not a field
- Tests now properly access the properties dictionary and run assertions
- Fixes ineffective tests that were silently failing due to reflection returning null
2025-10-20 18:34:33 -07:00
..
AssetPathUtility.cs New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
AssetPathUtility.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
CodexConfigHelper.cs refactor: use Tommy TOML library directly for config file manipulation (#328) 2025-10-18 13:08:41 -04:00
CodexConfigHelper.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
ConfigJsonBuilder.cs Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
ConfigJsonBuilder.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
ExecPath.cs Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
ExecPath.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
GameObjectSerializer.cs Fix material mesh instantiation warnings (#331) 2025-10-20 18:34:33 -07:00
GameObjectSerializer.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
McpConfigFileHelper.cs Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
McpConfigFileHelper.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
McpConfigurationHelper.cs refactor: use Tommy TOML library directly for config file manipulation (#328) 2025-10-18 13:08:41 -04:00
McpConfigurationHelper.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
McpLog.cs Add testing and move menu items to resources (#316) 2025-10-13 11:16:43 -04:00
McpLog.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
McpPathResolver.cs New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
McpPathResolver.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
PackageDetector.cs New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
PackageDetector.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
PackageInstaller.cs New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
PackageInstaller.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
PortManager.cs Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
PortManager.cs.meta Update certain file GUIDs to prevent conflict 2025-10-19 23:09:38 -04:00
PythonToolSyncProcessor.cs Allow users to easily add tools in the Asset folder (#324) 2025-10-18 00:18:25 -04:00
PythonToolSyncProcessor.cs.meta Allow users to easily add tools in the Asset folder (#324) 2025-10-18 00:18:25 -04:00
Response.cs Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
Response.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
ServerInstaller.cs Allow users to easily add tools in the Asset folder (#324) 2025-10-18 00:18:25 -04:00
ServerInstaller.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
ServerPathResolver.cs Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
ServerPathResolver.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
TelemetryHelper.cs New UI and work without MCP server embedded (#313) 2025-10-11 03:08:16 -04:00
TelemetryHelper.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
Vector3Helper.cs Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
Vector3Helper.cs.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00