chore: bump version to 9.6.6#1047
Conversation
…933782887 chore: sync main (v9.6.5) into beta
…71343948 chore: update Unity package to beta version 9.6.6-beta.2
…14653622 chore: update Unity package to beta version 9.6.6-beta.3
SceneView.lastActiveSceneView is null in batch mode, so stats_set_scene_debug correctly returns an error. Use Assume.That to mark the test inconclusive rather than failing CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e count - StatsSetSceneDebug_ValidMode test now asserts success when SceneView exists and correctly asserts failure when it doesn't (batch mode), instead of going inconclusive. - Workflow now parses NUnit XML for failed=0 rather than trusting the runner exit code, which returns 2 for inconclusive tests (URP, ProBuilder, Volumes not installed in CI). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…#1045) * Fix create_script validator false-positive on constructor invocations The regex-based duplicate method signature check misidentified `new Type(...)` constructor calls as method declarations, causing valid C# like `new GameObject("A"); new GameObject("B");` to be rejected. Capture the return-type token and skip when it is `new`. Addresses #1044 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address review: Ordinal comparison, add new-modifier + constructor test Use string.Equals with StringComparison.Ordinal for the "new" check. Add test combining `public new void Init()` with nearby constructor invocations to guard against modifier vs return-type parsing regressions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…62948128 chore: update Unity package to beta version 9.6.6-beta.4
Reviewer's GuideAdds component-index aware selection across VFX, physics, and component management (CLI, server tools, and Unity editor), improves script and graphics handling robustness, adjusts tests and CI behavior, and bumps package/server versions to 9.6.6. Sequence diagram for component_index-aware physics material assignmentsequenceDiagram
actor Developer
participant CLI_Physics as cli.physics.assign_material
participant Server_Physics as manage_physics_service
participant Unity_Tool as PhysicsMaterialOps
Developer->>CLI_Physics: physics assign-material -t Player -m matPath -i 1
CLI_Physics->>Server_Physics: manage_physics(action=assign_material, target, material_path, component_index=1)
Server_Physics->>Unity_Tool: Assign(params{ target, materialPath, collider_type, componentIndex=1 })
Unity_Tool->>Unity_Tool: GameObjectLookup.FindByTarget(target, searchMethod)
alt material3D available
Unity_Tool->>Unity_Tool: FindCollider3D(go, colliderType, index=1)
alt valid index
Unity_Tool-->>Server_Physics: SuccessResponse(collider3D updated)
else invalid index
Unity_Tool->>Unity_Tool: compute count3D = go.GetComponents(type3D).Length
Unity_Tool-->>Server_Physics: ErrorResponse("component_index 1 out of range. Found count3D ...")
end
else material2D available
Unity_Tool->>Unity_Tool: FindCollider2D(go, colliderType, index=1)
alt valid index
Unity_Tool-->>Server_Physics: SuccessResponse(collider2D updated)
else invalid index
Unity_Tool->>Unity_Tool: compute count2D = go.GetComponents(type2D).Length
Unity_Tool-->>Server_Physics: ErrorResponse("component_index 1 out of range. Found count2D ...")
end
else
Unity_Tool-->>Server_Physics: ErrorResponse("No suitable collider found ...")
end
Server_Physics-->>CLI_Physics: result (success or error)
CLI_Physics-->>Developer: formatted output
Sequence diagram for component_index-aware VFX particle infosequenceDiagram
actor Developer
participant CLI_Vfx as cli.vfx.particle_info
participant Server_Vfx as manage_vfx_service
participant Unity_Vfx as ParticleRead
participant VfxCommon as ManageVfxCommon
participant ParticleCommon as ParticleCommon
Developer->>CLI_Vfx: vfx particle info "Effects" --component-index 1
CLI_Vfx->>Server_Vfx: manage_vfx(action=particle_get_info, target, component_index=1)
Server_Vfx->>Unity_Vfx: GetInfo(params{ target, componentIndex=1 })
Unity_Vfx->>ParticleCommon: FindParticleSystem(params)
ParticleCommon->>VfxCommon: FindComponent<ParticleSystem>(params)
VfxCommon->>VfxCommon: FindTargetGameObject(params)
VfxCommon->>VfxCommon: idx = CoerceIntNullable(componentIndex)
alt idx within range
VfxCommon-->>ParticleCommon: ParticleSystem at index
ParticleCommon-->>Unity_Vfx: ParticleSystem
Unity_Vfx->>ParticleCommon: FindParticleSystemRenderer(ps)
Unity_Vfx-->>Server_Vfx: success payload with info
else idx out of range
VfxCommon-->>ParticleCommon: null
ParticleCommon->>VfxCommon: FindComponentError<ParticleSystem>(params)
VfxCommon-->>ParticleCommon: "component_index N out of range..."
ParticleCommon-->>Unity_Vfx: error message
Unity_Vfx-->>Server_Vfx: { success=false, message }
end
Server_Vfx-->>Developer: formatted result
Updated class diagram for VFX component discovery and error handlingclassDiagram
class ManageVfxCommon {
+GameObject FindTargetGameObject(JObject @params)
+Material FindMaterialByPath(string path)
+T FindComponent~T~(JObject @params)
+string FindComponentError~T~(JObject @params)
}
class ParticleCommon {
+ParticleSystem FindParticleSystem(JObject @params)
+string FindParticleSystemError(JObject @params)
+ParticleSystemRenderer FindParticleSystemRenderer(ParticleSystem ps)
+ParticleSystem.MinMaxCurve ParseMinMaxCurve(JToken token, float defaultValue)
}
class LineRead {
+LineRenderer FindLineRenderer(JObject @params)
+string FindLineRendererError(JObject @params)
+object GetInfo(JObject @params)
}
class TrailRead {
+TrailRenderer FindTrailRenderer(JObject @params)
+string FindTrailRendererError(JObject @params)
+object GetInfo(JObject @params)
}
ManageVfxCommon ..> ParticleCommon : used by
ManageVfxCommon ..> LineRead : used by
ManageVfxCommon ..> TrailRead : used by
ParticleCommon ..> ManageVfxCommon : calls FindComponent
LineRead ..> ManageVfxCommon : calls FindComponent
TrailRead ..> ManageVfxCommon : calls FindComponent
class ParticleWrite {
+object SetMain(JObject @params)
+object SetEmission(JObject @params)
+object SetShape(JObject @params)
+object SetColorOverLifetime(JObject @params)
+object SetSizeOverLifetime(JObject @params)
+object SetVelocityOverLifetime(JObject @params)
+object SetNoise(JObject @params)
+object SetRenderer(JObject @params)
-void EnsureParticleRendererMaterial(ParticleSystemRenderer renderer)
}
class ParticleRead {
+object GetInfo(JObject @params)
}
class ParticleControl {
+object EnableModule(JObject @params)
+object Control(JObject @params, string action)
+object AddBurst(JObject @params)
+object ClearBursts(JObject @params)
}
class LineWrite {
+object SetPositions(JObject @params)
+object AddPosition(JObject @params)
+object SetPosition(JObject @params)
+object SetWidth(JObject @params)
+object SetColor(JObject @params)
+object SetMaterial(JObject @params)
+object SetProperties(JObject @params)
+object Clear(JObject @params)
}
class LineCreate {
+object CreateLine(JObject @params)
+object CreateCircle(JObject @params)
+object CreateArc(JObject @params)
+object CreateBezier(JObject @params)
}
class TrailWrite {
+object SetTime(JObject @params)
+object SetWidth(JObject @params)
+object SetColor(JObject @params)
+object SetMaterial(JObject @params)
+object SetProperties(JObject @params)
}
class TrailControl {
+object Clear(JObject @params)
+object Emit(JObject @params)
}
ParticleWrite ..> ParticleCommon : uses
ParticleRead ..> ParticleCommon : uses
ParticleControl ..> ParticleCommon : uses
LineWrite ..> LineRead : uses
LineCreate ..> LineRead : uses
TrailWrite ..> TrailRead : uses
TrailControl ..> TrailRead : uses
Updated class diagram for component_index handling in editor physics and componentsclassDiagram
class PhysicsMaterialOps {
+object Assign(JObject @params)
-Collider FindCollider3D(GameObject go, string colliderType, int? index)
-Collider2D FindCollider2D(GameObject go, string colliderType, int? index)
}
class JointOps {
+object ConfigureJoint(JObject @params)
+object RemoveJoint(JObject @params)
-Component ResolveJoint(GameObject go, string jointTypeStr, int? index, out int foundCount)
}
class ManageComponents {
-object RemoveComponent(JObject @params, JToken targetToken, string searchMethod)
-object SetProperty(JObject @params, JToken targetToken, string searchMethod)
}
class ComponentOps {
+bool RemoveComponent(GameObject targetGo, System.Type type, out string error)
+bool SetObjectReference(SerializedProperty prop, JToken value, object context, out string error)
-bool IsHexString(string str)
}
PhysicsMaterialOps ..> GameObject : operates on
JointOps ..> GameObject : operates on
ManageComponents ..> ComponentOps : uses
class UnityReflect {
-object GetTypeInfo(ToolParams p)
-object GetMemberInfo(ToolParams p)
}
UnityReflect ..> System.Type : reflection
class FrameTimingOps {
+object GetFrameTiming(JObject @params)
}
class CounterOps {
-string[] ValidCategories
-ProfilerCategory GetCategory(string category)
}
FrameTimingOps ..> UnityEngine.FrameTimingManager : uses
CounterOps ..> UnityEngine.Profiling.ProfilerCategory : maps
class ManageScript {
-bool TryComputeMethodSpan(...)
-void CheckDuplicateMethodSignatures(string contents, System.Collections.Generic.List~string~ errors)
}
ManageScript ..> System.Text.RegularExpressions.Regex : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="MCPForUnity/Editor/Tools/Vfx/ManageVfxCommon.cs" line_range="35-39" />
<code_context>
+ return go.GetComponent<T>();
+ }
+
+ public static string FindComponentError<T>(JObject @params) where T : Component
+ {
+ string typeName = typeof(T).Name;
+ GameObject go = FindTargetGameObject(@params);
+ if (go == null) return $"{typeName} not found";
+ int? idx = ParamCoercion.CoerceIntNullable(@params["componentIndex"] ?? @params["component_index"]);
+ if (idx.HasValue)
</code_context>
<issue_to_address>
**suggestion:** Differentiate between missing GameObject and missing component in error messages.
When `FindTargetGameObject(@params)` returns null, the method currently returns `"{typeName} not found"`, which is the same message used when the GameObject exists but the component is missing. This makes it hard to tell whether the issue is the search target or the component. Consider a distinct message for the null GameObject case (e.g. including the target token), and reserve something like `"{typeName} not found on '<name>'"` for when the GameObject is found but lacks the component. This will make CLI errors more actionable and consistent with other tools.
Suggested implementation:
```csharp
GameObject go = FindTargetGameObject(@params);
if (go == null)
{
// Try to surface the original target identifier for better diagnostics
var targetToken = @params["target"]
?? @params["gameObject"]
?? @params["game_object"];
var targetDescription = targetToken != null
? targetToken.ToString()
: "<unknown>";
return $"Target GameObject '{targetDescription}' not found for component type '{typeName}'";
}
```
To fully align with your comment about reserving messages like `"{typeName} not found on '<name>'"` for the case where the GameObject exists but the component is missing, you should also:
1. Update the branch in `FindComponentError<T>` that handles "component not found" to return a message similar to `return $"{typeName} not found on '{go.name}'";`.
2. If you have an index-based component lookup in this method, consider providing a specific message for out-of-range indices, e.g. `return $"{typeName} at index {idx.Value} not found on '{go.name}'";`.
These additional changes should be made inside the same `FindComponentError<T>` method, in the branches that currently return the generic `"{typeName} not found"` string when the GameObject is non-null but the component lookup fails.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| public static string FindComponentError<T>(JObject @params) where T : Component | ||
| { | ||
| string typeName = typeof(T).Name; | ||
| GameObject go = FindTargetGameObject(@params); | ||
| if (go == null) return $"{typeName} not found"; |
There was a problem hiding this comment.
suggestion: Differentiate between missing GameObject and missing component in error messages.
When FindTargetGameObject(@params) returns null, the method currently returns "{typeName} not found", which is the same message used when the GameObject exists but the component is missing. This makes it hard to tell whether the issue is the search target or the component. Consider a distinct message for the null GameObject case (e.g. including the target token), and reserve something like "{typeName} not found on '<name>'" for when the GameObject is found but lacks the component. This will make CLI errors more actionable and consistent with other tools.
Suggested implementation:
GameObject go = FindTargetGameObject(@params);
if (go == null)
{
// Try to surface the original target identifier for better diagnostics
var targetToken = @params["target"]
?? @params["gameObject"]
?? @params["game_object"];
var targetDescription = targetToken != null
? targetToken.ToString()
: "<unknown>";
return $"Target GameObject '{targetDescription}' not found for component type '{typeName}'";
}To fully align with your comment about reserving messages like "{typeName} not found on '<name>'" for the case where the GameObject exists but the component is missing, you should also:
- Update the branch in
FindComponentError<T>that handles "component not found" to return a message similar toreturn $"{typeName} not found on '{go.name}'";. - If you have an index-based component lookup in this method, consider providing a specific message for out-of-range indices, e.g.
return $"{typeName} at index {idx.Value} not found on '{go.name}'";.
These additional changes should be made inside the same FindComponentError<T> method, in the branches that currently return the generic "{typeName} not found" string when the GameObject is non-null but the component lookup fails.
Automated version bump to 9.6.6.
Summary by Sourcery
Add index-based targeting and improved error reporting across components, physics, and VFX tools, harden reflection and script validation behaviors, and update tests, CI, and versioning.
New Features:
Bug Fixes:
Enhancements:
Build:
CI:
Tests: