diff --git a/Unity-Package/Assets/root/Editor/Scripts/Data.meta b/Unity-Package/Assets/root/Editor/Scripts/Data.meta
new file mode 100644
index 0000000..e922220
--- /dev/null
+++ b/Unity-Package/Assets/root/Editor/Scripts/Data.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 74c55f1b3e477ac41b7ed8ea22f9c72b
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity-Package/Assets/root/Editor/Scripts/Data/GetParticleSystemResponse.cs b/Unity-Package/Assets/root/Editor/Scripts/Data/GetParticleSystemResponse.cs
new file mode 100644
index 0000000..f622880
--- /dev/null
+++ b/Unity-Package/Assets/root/Editor/Scripts/Data/GetParticleSystemResponse.cs
@@ -0,0 +1,123 @@
+/*
+┌─────────────────────────────────────────────────────────────────────────────┐
+│ Author: Ivan Murzak (https://github.com/IvanMurzak) │
+│ Repository: GitHub (https://github.com/IvanMurzak/Unity-AI-ParticleSystem) │
+│ Copyright (c) 2025 Ivan Murzak │
+│ Licensed under the MIT License. │
+│ See the LICENSE file in the project root for more information. │
+└─────────────────────────────────────────────────────────────────────────────┘
+*/
+
+#nullable enable
+using System.ComponentModel;
+using com.IvanMurzak.ReflectorNet.Model;
+using com.IvanMurzak.Unity.MCP.Runtime.Data;
+
+namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor
+{
+ ///
+ /// Response model for Get ParticleSystem tool.
+ ///
+ [Description("Response containing ParticleSystem data with requested modules.")]
+ public class GetParticleSystemResponse
+ {
+ [Description("Reference to the GameObject containing the ParticleSystem component.")]
+ public GameObjectRef? gameObjectRef;
+
+ [Description("Reference to the ParticleSystem component.")]
+ public ComponentRef? componentRef;
+
+ [Description("Index of the ParticleSystem component in the GameObject's component list.")]
+ public int componentIndex = -1;
+
+ [Description("Whether the ParticleSystem is currently playing.")]
+ public bool isPlaying;
+
+ [Description("Whether the ParticleSystem is currently paused.")]
+ public bool isPaused;
+
+ [Description("Whether the ParticleSystem is currently emitting.")]
+ public bool isEmitting;
+
+ [Description("Whether the ParticleSystem is currently stopped.")]
+ public bool isStopped;
+
+ [Description("Current particle count.")]
+ public int particleCount;
+
+ [Description("Current simulation time.")]
+ public float time;
+
+ [Description("Main module data.")]
+ public SerializedMember? main;
+
+ [Description("Emission module data.")]
+ public SerializedMember? emission;
+
+ [Description("Shape module data.")]
+ public SerializedMember? shape;
+
+ [Description("Velocity over Lifetime module data.")]
+ public SerializedMember? velocityOverLifetime;
+
+ [Description("Limit Velocity over Lifetime module data.")]
+ public SerializedMember? limitVelocityOverLifetime;
+
+ [Description("Inherit Velocity module data.")]
+ public SerializedMember? inheritVelocity;
+
+ [Description("Lifetime by Emitter Speed module data.")]
+ public SerializedMember? lifetimeByEmitterSpeed;
+
+ [Description("Force over Lifetime module data.")]
+ public SerializedMember? forceOverLifetime;
+
+ [Description("Color over Lifetime module data.")]
+ public SerializedMember? colorOverLifetime;
+
+ [Description("Color by Speed module data.")]
+ public SerializedMember? colorBySpeed;
+
+ [Description("Size over Lifetime module data.")]
+ public SerializedMember? sizeOverLifetime;
+
+ [Description("Size by Speed module data.")]
+ public SerializedMember? sizeBySpeed;
+
+ [Description("Rotation over Lifetime module data.")]
+ public SerializedMember? rotationOverLifetime;
+
+ [Description("Rotation by Speed module data.")]
+ public SerializedMember? rotationBySpeed;
+
+ [Description("External Forces module data.")]
+ public SerializedMember? externalForces;
+
+ [Description("Noise module data.")]
+ public SerializedMember? noise;
+
+ [Description("Collision module data.")]
+ public SerializedMember? collision;
+
+ [Description("Trigger module data.")]
+ public SerializedMember? trigger;
+
+ [Description("Sub Emitters module data.")]
+ public SerializedMember? subEmitters;
+
+ [Description("Texture Sheet Animation module data.")]
+ public SerializedMember? textureSheetAnimation;
+
+ [Description("Lights module data.")]
+ public SerializedMember? lights;
+
+ [Description("Trails module data.")]
+ public SerializedMember? trails;
+
+ [Description("Custom Data module data.")]
+ public SerializedMember? customData;
+
+ [Description("Renderer module data.")]
+ public SerializedMember? renderer;
+ }
+}
diff --git a/Unity-Package/Assets/root/Editor/Scripts/Data/GetParticleSystemResponse.cs.meta b/Unity-Package/Assets/root/Editor/Scripts/Data/GetParticleSystemResponse.cs.meta
new file mode 100644
index 0000000..c826e26
--- /dev/null
+++ b/Unity-Package/Assets/root/Editor/Scripts/Data/GetParticleSystemResponse.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a2fadae63d851a0449634c5b27666009
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity-Package/Assets/root/Editor/Scripts/Data/ModifyParticleSystemResponse.cs b/Unity-Package/Assets/root/Editor/Scripts/Data/ModifyParticleSystemResponse.cs
new file mode 100644
index 0000000..eb06cc7
--- /dev/null
+++ b/Unity-Package/Assets/root/Editor/Scripts/Data/ModifyParticleSystemResponse.cs
@@ -0,0 +1,38 @@
+/*
+┌─────────────────────────────────────────────────────────────────────────────┐
+│ Author: Ivan Murzak (https://github.com/IvanMurzak) │
+│ Repository: GitHub (https://github.com/IvanMurzak/Unity-AI-ParticleSystem) │
+│ Copyright (c) 2025 Ivan Murzak │
+│ Licensed under the MIT License. │
+│ See the LICENSE file in the project root for more information. │
+└─────────────────────────────────────────────────────────────────────────────┘
+*/
+
+#nullable enable
+using System.ComponentModel;
+using com.IvanMurzak.Unity.MCP.Runtime.Data;
+
+namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor
+{
+ ///
+ /// Response model for Modify ParticleSystem tool.
+ ///
+ [Description("Response containing the result of modifying a ParticleSystem.")]
+ public class ModifyParticleSystemResponse
+ {
+ [Description("Whether the modification was successful.")]
+ public bool success;
+
+ [Description("Reference to the GameObject containing the ParticleSystem component.")]
+ public GameObjectRef? gameObjectRef;
+
+ [Description("Reference to the modified ParticleSystem component.")]
+ public ComponentRef? componentRef;
+
+ [Description("Index of the ParticleSystem component in the GameObject's component list.")]
+ public int componentIndex = -1;
+
+ [Description("Log of modifications made and any warnings/errors encountered.")]
+ public string[]? logs;
+ }
+}
diff --git a/Unity-Package/Assets/root/Editor/Scripts/Data/ModifyParticleSystemResponse.cs.meta b/Unity-Package/Assets/root/Editor/Scripts/Data/ModifyParticleSystemResponse.cs.meta
new file mode 100644
index 0000000..356283e
--- /dev/null
+++ b/Unity-Package/Assets/root/Editor/Scripts/Data/ModifyParticleSystemResponse.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 04741089789bdb54093c87413632499e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystemData.cs b/Unity-Package/Assets/root/Editor/Scripts/Data/ParticleSystemData.cs
similarity index 61%
rename from Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystemData.cs
rename to Unity-Package/Assets/root/Editor/Scripts/Data/ParticleSystemData.cs
index be5eeaf..16c716b 100644
--- a/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystemData.cs
+++ b/Unity-Package/Assets/root/Editor/Scripts/Data/ParticleSystemData.cs
@@ -13,7 +13,7 @@
using com.IvanMurzak.ReflectorNet.Model;
using com.IvanMurzak.Unity.MCP.Runtime.Data;
-namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor.API
+namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor
{
///
/// Data model for ParticleSystem component containing serialized data for all modules.
@@ -104,132 +104,4 @@ public class ParticleSystemData
[Description("Renderer module data: renderMode, sortMode, lengthScale, velocityScale, cameraVelocityScale, normalDirection, sortingFudge, minParticleSize, maxParticleSize, alignment, flip, allowRoll, pivot, maskInteraction, material, trailMaterial, shadowCastingMode, receiveShadows, shadowBias, motionVectorGenerationMode, sortingLayerID, sortingLayerName, sortingOrder, lightProbeUsage, reflectionProbeUsage, probeAnchor.")]
public SerializedMember? renderer;
}
-
- ///
- /// Response model for Get ParticleSystem tool.
- ///
- [Description("Response containing ParticleSystem data with requested modules.")]
- public class GetParticleSystemResponse
- {
- [Description("Reference to the GameObject containing the ParticleSystem component.")]
- public GameObjectRef? gameObjectRef;
-
- [Description("Reference to the ParticleSystem component.")]
- public ComponentRef? componentRef;
-
- [Description("Index of the ParticleSystem component in the GameObject's component list.")]
- public int componentIndex = -1;
-
- [Description("Whether the ParticleSystem is currently playing.")]
- public bool isPlaying;
-
- [Description("Whether the ParticleSystem is currently paused.")]
- public bool isPaused;
-
- [Description("Whether the ParticleSystem is currently emitting.")]
- public bool isEmitting;
-
- [Description("Whether the ParticleSystem is currently stopped.")]
- public bool isStopped;
-
- [Description("Current particle count.")]
- public int particleCount;
-
- [Description("Current simulation time.")]
- public float time;
-
- [Description("Main module data.")]
- public SerializedMember? main;
-
- [Description("Emission module data.")]
- public SerializedMember? emission;
-
- [Description("Shape module data.")]
- public SerializedMember? shape;
-
- [Description("Velocity over Lifetime module data.")]
- public SerializedMember? velocityOverLifetime;
-
- [Description("Limit Velocity over Lifetime module data.")]
- public SerializedMember? limitVelocityOverLifetime;
-
- [Description("Inherit Velocity module data.")]
- public SerializedMember? inheritVelocity;
-
- [Description("Lifetime by Emitter Speed module data.")]
- public SerializedMember? lifetimeByEmitterSpeed;
-
- [Description("Force over Lifetime module data.")]
- public SerializedMember? forceOverLifetime;
-
- [Description("Color over Lifetime module data.")]
- public SerializedMember? colorOverLifetime;
-
- [Description("Color by Speed module data.")]
- public SerializedMember? colorBySpeed;
-
- [Description("Size over Lifetime module data.")]
- public SerializedMember? sizeOverLifetime;
-
- [Description("Size by Speed module data.")]
- public SerializedMember? sizeBySpeed;
-
- [Description("Rotation over Lifetime module data.")]
- public SerializedMember? rotationOverLifetime;
-
- [Description("Rotation by Speed module data.")]
- public SerializedMember? rotationBySpeed;
-
- [Description("External Forces module data.")]
- public SerializedMember? externalForces;
-
- [Description("Noise module data.")]
- public SerializedMember? noise;
-
- [Description("Collision module data.")]
- public SerializedMember? collision;
-
- [Description("Trigger module data.")]
- public SerializedMember? trigger;
-
- [Description("Sub Emitters module data.")]
- public SerializedMember? subEmitters;
-
- [Description("Texture Sheet Animation module data.")]
- public SerializedMember? textureSheetAnimation;
-
- [Description("Lights module data.")]
- public SerializedMember? lights;
-
- [Description("Trails module data.")]
- public SerializedMember? trails;
-
- [Description("Custom Data module data.")]
- public SerializedMember? customData;
-
- [Description("Renderer module data.")]
- public SerializedMember? renderer;
- }
-
- ///
- /// Response model for Modify ParticleSystem tool.
- ///
- [Description("Response containing the result of modifying a ParticleSystem.")]
- public class ModifyParticleSystemResponse
- {
- [Description("Whether the modification was successful.")]
- public bool success;
-
- [Description("Reference to the GameObject containing the ParticleSystem component.")]
- public GameObjectRef? gameObjectRef;
-
- [Description("Reference to the modified ParticleSystem component.")]
- public ComponentRef? componentRef;
-
- [Description("Index of the ParticleSystem component in the GameObject's component list.")]
- public int componentIndex = -1;
-
- [Description("Log of modifications made and any warnings/errors encountered.")]
- public string[]? logs;
- }
}
diff --git a/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystemData.cs.meta b/Unity-Package/Assets/root/Editor/Scripts/Data/ParticleSystemData.cs.meta
similarity index 100%
rename from Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystemData.cs.meta
rename to Unity-Package/Assets/root/Editor/Scripts/Data/ParticleSystemData.cs.meta
diff --git a/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.Get.cs b/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.Get.cs
index 20b1a07..0776f76 100644
--- a/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.Get.cs
+++ b/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.Get.cs
@@ -18,7 +18,7 @@
using com.IvanMurzak.Unity.MCP.Utils;
using Microsoft.Extensions.Logging;
-namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor.API
+namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor
{
public partial class Tool_ParticleSystem
{
@@ -121,6 +121,12 @@ public GetParticleSystemResponse Get
bool deepSerialization = false
)
{
+ if (gameObjectRef == null)
+ throw new ArgumentNullException(nameof(gameObjectRef));
+
+ if (!gameObjectRef.IsValid(out var gameObjectValidationError))
+ throw new ArgumentException(gameObjectValidationError, nameof(gameObjectRef));
+
return MainThread.Instance.Run(() =>
{
var go = gameObjectRef.FindGameObject(out var error);
@@ -128,7 +134,7 @@ public GetParticleSystemResponse Get
throw new Exception(error);
if (go == null)
- throw new Exception(Error.GameObjectNotFound());
+ throw new Exception("GameObject not found.");
// Find the ParticleSystem component
UnityEngine.ParticleSystem? ps = null;
@@ -141,7 +147,7 @@ public GetParticleSystemResponse Get
if (comp == null)
continue;
- if (componentRef != null && componentRef.IsValid)
+ if (componentRef != null && componentRef.IsValid(out _))
{
if (componentRef.Matches(allComponents[i], i))
{
@@ -160,7 +166,7 @@ public GetParticleSystemResponse Get
}
if (ps == null)
- throw new Exception(Error.ParticleSystemNotFound());
+ throw new Exception("ParticleSystem component not found on the specified GameObject.");
var response = new GetParticleSystemResponse
{
diff --git a/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.Modify.cs b/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.Modify.cs
index 3ca254a..bb57619 100644
--- a/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.Modify.cs
+++ b/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.Modify.cs
@@ -16,12 +16,13 @@
using com.IvanMurzak.McpPlugin;
using com.IvanMurzak.ReflectorNet.Model;
using com.IvanMurzak.ReflectorNet.Utils;
+using com.IvanMurzak.Unity.MCP.Editor.Utils;
using com.IvanMurzak.Unity.MCP.Runtime.Data;
using com.IvanMurzak.Unity.MCP.Runtime.Extensions;
using com.IvanMurzak.Unity.MCP.Utils;
using Microsoft.Extensions.Logging;
-namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor.API
+namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor
{
public partial class Tool_ParticleSystem
{
@@ -118,6 +119,12 @@ public ModifyParticleSystemResponse Modify
SerializedMember? renderer = null
)
{
+ if (gameObjectRef == null)
+ throw new ArgumentNullException(nameof(gameObjectRef));
+
+ if (!gameObjectRef.IsValid(out var gameObjectValidationError))
+ throw new ArgumentException(gameObjectValidationError, nameof(gameObjectRef));
+
return MainThread.Instance.Run(() =>
{
var go = gameObjectRef.FindGameObject(out var error);
@@ -125,7 +132,7 @@ public ModifyParticleSystemResponse Modify
throw new Exception(error);
if (go == null)
- throw new Exception(Error.GameObjectNotFound());
+ throw new Exception("GameObject not found.");
// Find the ParticleSystem component
UnityEngine.ParticleSystem? ps = null;
@@ -138,7 +145,7 @@ public ModifyParticleSystemResponse Modify
if (comp == null)
continue;
- if (componentRef != null && componentRef.IsValid)
+ if (componentRef != null && componentRef.IsValid(out _))
{
if (componentRef.Matches(allComponents[i], i))
{
@@ -157,7 +164,7 @@ public ModifyParticleSystemResponse Modify
}
if (ps == null)
- throw new Exception(Error.ParticleSystemNotFound());
+ throw new Exception("ParticleSystem component not found on the specified GameObject.");
var response = new ModifyParticleSystemResponse
{
@@ -503,7 +510,7 @@ public ModifyParticleSystemResponse Modify
logs.Add("No modifications were made.");
}
- UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
+ EditorUtils.RepaintAllEditorWindows();
response.logs = logs.ToArray();
return response;
diff --git a/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.cs b/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.cs
index 7569fa5..9dc5645 100644
--- a/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.cs
+++ b/Unity-Package/Assets/root/Editor/Scripts/Tools/ParticleSystem.cs
@@ -9,31 +9,13 @@
*/
#nullable enable
-using System.ComponentModel;
using com.IvanMurzak.McpPlugin;
-using com.IvanMurzak.Unity.MCP.Runtime.Data;
-namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor.API
+namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor
{
[McpPluginToolType]
public partial class Tool_ParticleSystem
{
- public static class Error
- {
- public static string GameObjectNotFound()
- => "GameObject not found.";
-
- public static string ParticleSystemNotFound()
- => "ParticleSystem component not found on the GameObject.";
-
- public static string InvalidGameObjectRef()
- => "Invalid GameObjectRef. Provide instanceID, path, or name.";
-
- public static string InvalidComponentRef()
- => "Invalid ComponentRef. Provide instanceID, index, or typeName.";
-
- public static string NoDataProvided()
- => "No data provided to modify.";
- }
+ // empty
}
}
diff --git a/Unity-Package/Assets/root/Tests/Editor/TestToolParticleSystemGet.cs b/Unity-Package/Assets/root/Tests/Editor/TestToolParticleSystemGet.cs
index 965b1db..39828fd 100644
--- a/Unity-Package/Assets/root/Tests/Editor/TestToolParticleSystemGet.cs
+++ b/Unity-Package/Assets/root/Tests/Editor/TestToolParticleSystemGet.cs
@@ -10,10 +10,8 @@
#nullable enable
using System.Collections;
-using com.IvanMurzak.Unity.MCP.ParticleSystem.Editor.API;
using com.IvanMurzak.Unity.MCP.Runtime.Data;
using NUnit.Framework;
-using UnityEngine;
using UnityEngine.TestTools;
namespace com.IvanMurzak.Unity.MCP.ParticleSystem.Editor.Tests
diff --git a/Unity-Package/Assets/root/Tests/Editor/TestToolParticleSystemModify.cs b/Unity-Package/Assets/root/Tests/Editor/TestToolParticleSystemModify.cs
index 9de7ce0..ecf7a34 100644
--- a/Unity-Package/Assets/root/Tests/Editor/TestToolParticleSystemModify.cs
+++ b/Unity-Package/Assets/root/Tests/Editor/TestToolParticleSystemModify.cs
@@ -11,7 +11,6 @@
#nullable enable
using System.Collections;
using com.IvanMurzak.ReflectorNet.Model;
-using com.IvanMurzak.Unity.MCP.ParticleSystem.Editor.API;
using com.IvanMurzak.Unity.MCP.Runtime.Data;
using NUnit.Framework;
using UnityEngine;
diff --git a/Unity-Package/Packages/packages-lock.json b/Unity-Package/Packages/packages-lock.json
index 8385225..076ffa6 100644
--- a/Unity-Package/Packages/packages-lock.json
+++ b/Unity-Package/Packages/packages-lock.json
@@ -1,16 +1,16 @@
{
"dependencies": {
"com.ivanmurzak.unity.mcp": {
- "version": "0.40.0",
+ "version": "0.41.0",
"depth": 0,
"source": "registry",
"dependencies": {
- "com.unity.test-framework": "1.1.33",
"com.unity.modules.uielements": "1.0.0",
+ "com.unity.test-framework": "1.1.33",
"extensions.unity.playerprefsex": "2.1.2",
- "org.nuget.microsoft.bcl.memory": "10.0.1",
"org.nuget.microsoft.aspnetcore.signalr.client": "10.0.1",
"org.nuget.microsoft.aspnetcore.signalr.protocols.json": "10.0.1",
+ "org.nuget.microsoft.bcl.memory": "10.0.1",
"org.nuget.microsoft.codeanalysis.csharp": "4.14.0",
"org.nuget.microsoft.extensions.caching.abstractions": "10.0.1",
"org.nuget.microsoft.extensions.dependencyinjection.abstractions": "10.0.1",