Skip to content

Conversation

@IvanMurzak
Copy link
Owner

This pull request introduces significant improvements to data population and serialization logic for Unity assets, along with enhanced test coverage. The main changes include extending support for asset references in converters, improving logging and error handling in reflection converters, and adding comprehensive tests for data population and material reflection conversion.

Serialization and Converter Enhancements

  • Added support for serializing and deserializing AssetPath and AssetGuid properties in GameObjectRefConverter, allowing GameObjectRef to carry asset reference data. [1] [2]
  • Improved error messages in AssetObjectRefConverter to include the converter's name for better debugging.

Reflection Converter Improvements

  • Enhanced error handling and logging in UnityEngine_GameObject_ReflectionConvertor: changed logging levels, added detailed trace and error logs, and improved exception reporting when setting or populating values. [1] [2]

Test Coverage Expansion

  • Added new test scripts and ScriptableObjects (DataPopulationTestScript, DataPopulationTestScriptableObject) to cover a wide range of Unity asset types for data population scenarios. [1] [2] [3] [4]
  • Introduced a comprehensive DataPopulationTests suite to validate correct population of various asset fields and arrays in Unity components. [1] [2]
  • Added a new test class for material reflection converter logic, including setup and teardown routines. [1] [2]

Minor Cleanups

  • Removed unused ReflectorNet.Utils imports from several test files for better maintainability. [1] [2] [3] [4]
  • Added new .meta files for test assets and folders to support Unity's asset database. [1] [2] [3] [4] [5]

These changes collectively improve the reliability and flexibility of asset serialization, error reporting, and automated testing for Unity MCP plugins.

@IvanMurzak IvanMurzak requested a review from Copilot November 28, 2025 11:28
@IvanMurzak IvanMurzak self-assigned this Nov 28, 2025
@IvanMurzak IvanMurzak added the bug Something isn't working label Nov 28, 2025
Copilot finished reviewing on behalf of IvanMurzak November 28, 2025 11:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances the Unity MCP plugin's data population and serialization capabilities by extending asset reference support in converters, improving error handling and logging in reflection converters, and adding comprehensive test coverage for material and asset population scenarios.

Key Changes

  • Extended GameObjectRefConverter to serialize/deserialize AssetPath and AssetGuid properties, enabling GameObjectRef to carry asset metadata
  • Refactored UnityEngine_GameObject_ReflectionConvertor.SetValue() to actually deserialize and set GameObject values instead of just logging warnings
  • Added comprehensive test infrastructure with new executor classes for creating and managing test assets (textures, prefabs, ScriptableObjects, materials, GameObjects)

Reviewed changes

Copilot reviewed 28 out of 31 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
Unity-MCP-Plugin/Assets/root/Runtime/Converter/JsonConverters/Types/GameObjectRefConverter.cs Added AssetPath and AssetGuid serialization support to GameObjectRef
Unity-MCP-Plugin/Assets/root/Runtime/Converter/JsonConverters/Types/AssetObjectRefConverter.cs Improved error message with converter name
Unity-MCP-Plugin/Assets/root/Runtime/Converter/ReflectionConverters/UnityEngine_GameObject_ReflectionConvertor.cs Implemented actual GameObject deserialization in SetValue() and added logging to TryPopulateField()
Unity-MCP-Plugin/Assets/root/Tests/Editor/ReflectionConverter/DataPopulationTests.cs New comprehensive test for validating asset field and array population
Unity-MCP-Plugin/Assets/root/Tests/Editor/ReflectionConverter/MaterialReflectionConverterTests.cs New test class for material reflection converter (currently with commented-out test)
Unity-MCP-Plugin/Assets/root/Tests/Editor/Utils/Executor/*.cs New test utility executors for creating GameObjects, components, assets, and calling tools dynamically
Unity-MCP-Plugin/Assets/root/TestFiles/Scripts/DataPopulationTestScript.cs New MonoBehaviour with various field types for testing data population
Unity-MCP-Plugin/Assets/root/TestFiles/Scripts/DataPopulationTestScriptableObject.cs New ScriptableObject for testing ScriptableObject population
Unity-MCP-Plugin/Assets/root/Tests/Editor/RefTypes/*.cs Removed unused ReflectorNet.Utils imports
Unity-MCP-Plugin/Assets/root/Tests/Editor/Tool/Assets/AssetsMaterialTests.cs Removed unused imports
Unity-MCP-Plugin/Assets/root/Plugins/com.IvanMurzak.McpPlugin/netstandard2.1/McpPlugin.Common.dll Updated binary dependency

…proved clarity; update material array assertions in DataPopulationTests; remove obsolete MaterialReflectionConverterTests; optimize texture creation in CreateTextureExecutor; enhance resource management in DynamicCallToolExecutor.
…ndling; include licensing information in executor files
- Created DataFieldPopulationTestScript and DataFieldPopulationTestScriptableObject classes to define various data fields for testing.
- Implemented DataPropertyPopulationTestScript and DataPropertyPopulationTestScriptableObject classes to utilize properties instead of fields.
- Added corresponding test scripts: DataFieldScriptableObjectPopulationTests and DataPropertyScriptableObjectPopulationTests to validate the population of fields and properties.
- Updated existing tests to reference the new classes and ensure proper population of data.
- Removed obsolete DataPopulationTestScriptableObject class to streamline the codebase.
@IvanMurzak IvanMurzak requested a review from Copilot November 29, 2025 11:14
Copilot finished reviewing on behalf of IvanMurzak November 29, 2025 11:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 55 out of 58 changed files in this pull request and generated 5 comments.

@IvanMurzak IvanMurzak merged commit 85c24ed into main Nov 30, 2025
37 checks passed
@IvanMurzak IvanMurzak deleted the fix/material-array-population branch November 30, 2025 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants