Skip to content

Conversation

@IvanMurzak
Copy link
Owner

@IvanMurzak IvanMurzak commented Jan 22, 2026

This pull request refactors and reorganizes the data models and tool responses for the ParticleSystem editor integration. The main changes include moving response models into their own files and namespaces, improving validation and error handling, and updating utility usage for better maintainability.

Refactoring and Code Organization:

  • Moved GetParticleSystemResponse and ModifyParticleSystemResponse classes out of ParticleSystemData.cs into their own dedicated files (GetParticleSystemResponse.cs and ModifyParticleSystemResponse.cs) under the com.IvanMurzak.Unity.MCP.ParticleSystem.Editor namespace for better separation of concerns. [1] [2] [3]
  • Updated file and folder structure accordingly, including the addition of corresponding .meta files for Unity asset management. [1] [2] [3]
  • Changed all relevant namespaces from .Editor.API to .Editor for consistency and clarity across the codebase. [1] [2] [3] [4] [5]

Validation and Error Handling Improvements:

  • Added explicit validation for gameObjectRef in both the Get and Modify methods, throwing clear exceptions when the reference is invalid or null, and replaced usage of the removed Error static class with direct error messages. [1] [2] [3] [4] [5]
  • Updated the check for componentRef validity to use the new IsValid(out _) signature for improved robustness. [1] [2]

Utility and Maintenance Updates:

  • Replaced UnityEditorInternal.InternalEditorUtility.RepaintAllViews() with EditorUtils.RepaintAllEditorWindows() for editor refreshes, likely for improved compatibility or abstraction.

These changes collectively improve code modularity, testability, and maintainability, while making error handling more explicit and robust.

Copilot AI review requested due to automatic review settings January 22, 2026 02:31
@IvanMurzak IvanMurzak self-assigned this Jan 22, 2026
@IvanMurzak IvanMurzak added the enhancement New feature or request label Jan 22, 2026
Copy link

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 PR refactors the MCP (Model Context Protocol) tools for Unity ParticleSystem integration by reorganizing code structure, updating the underlying package version, and improving API consistency.

Changes:

  • Upgraded com.ivanmurzak.unity.mcp package from version 0.40.0 to 0.41.0
  • Refactored namespace structure by removing the .API suffix (e.g., com.IvanMurzak.Unity.MCP.ParticleSystem.Editor.APIcom.IvanMurzak.Unity.MCP.ParticleSystem.Editor)
  • Extracted response model classes (GetParticleSystemResponse, ModifyParticleSystemResponse) from ParticleSystemData.cs into separate files for better organization
  • Removed the Error helper class and replaced it with inline error messages
  • Enhanced validation by adding null checks and proper validation for gameObjectRef parameters
  • Updated API usage to match the new package version (changed IsValid from property to method, replaced InternalEditorUtility.RepaintAllViews() with EditorUtils.RepaintAllEditorWindows())

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Unity-Package/Packages/packages-lock.json Updated MCP package version from 0.40.0 to 0.41.0 and reordered dependencies alphabetically
Unity-Package/Assets/root/Tests/Editor/TestToolParticleSystemModify.cs Removed unused API namespace import after namespace refactoring
Unity-Package/Assets/root/Tests/Editor/TestToolParticleSystemGet.cs Removed unused API namespace and UnityEngine imports
Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.cs Changed namespace and removed Error helper class, simplified to empty partial class declaration
Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.Modify.cs Added validation, updated namespace, added EditorUtils usage, replaced Error class with inline strings, updated API calls
Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.Get.cs Applied same refactoring as Modify.cs with validation improvements and namespace changes
Unity-Package/Assets/root/Editor/Scripts/Data/ParticleSystemData.cs Removed response classes (moved to separate files) and updated namespace
Unity-Package/Assets/root/Editor/Scripts/Data/ModifyParticleSystemResponse.cs New file containing ModifyParticleSystemResponse class extracted from ParticleSystemData.cs
Unity-Package/Assets/root/Editor/Scripts/Data/GetParticleSystemResponse.cs New file containing GetParticleSystemResponse class extracted from ParticleSystemData.cs
Unity-Package/Assets/root/Editor/Scripts/Data/*.meta Unity metadata files for new Data folder and files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@IvanMurzak IvanMurzak merged commit 19e6201 into main Jan 22, 2026
42 checks passed
@IvanMurzak IvanMurzak deleted the update/general-improvements branch January 22, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants