Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable public changes to Nexus Unity are documented here.
- Relicensed Nexus Unity from `GPL-3.0-only` to the `MIT` license to remove copyleft friction for commercial Unity studios. All prior contributors consented to the relicense.

### Fixed
- `add_component` now returns a clear `GameObject not found` error for stale instance IDs instead of throwing a raw Unity null reference.
- `batch_execute` now caps batches at 50 requests and rejects nested batch execution.
- `create_primitive` now validates parent, transform, and material inputs before creating the GameObject, and Vector3 inputs accept `[x, y, z]` arrays as well as `{x, y, z}` objects.
- `get_game_object` now returns transform state and a compact component list so agents can verify basic write operations with the cheap read-back call.
Expand Down
1 change: 1 addition & 0 deletions Editor/MCPServerMethods.Component.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ private static JToken AddComponent(JToken p)
{
if (p == null || p["instance_id"] == null || p["component_name"] == null) throw new Exception("instance_id and component_name required");
var go = MCPServerMethods.IdToObject(MCPServerMethods.ExtractId(p)) as GameObject;
if (go == null) throw new Exception("GameObject not found");
Type type = FindType(p["component_name"].ToString());
if (type == null) throw new Exception($"Type '{p["component_name"]}' not found");
return new JObject { ["status"] = "Success", ["message"] = $"Added {p["component_name"]} to {Undo.AddComponent(go, type).name}" };
Expand Down
12 changes: 12 additions & 0 deletions Tests~/Editor/ConsolidatedManagersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,18 @@ public void GetGameObject_ReturnsTransformAndComponentsForReadBackVerification()
Assert.IsTrue(components.Any(c => c["type"]?.ToString() == "BoxCollider"));
}

[Test]
public void AddComponent_StaleInstanceId_ReturnsGameObjectNotFound() {
var go = CreateTestGameObject();
int staleId = go.GetInstanceID();
GameObject.DestroyImmediate(go);

var res = CallRaw("add_component", new JObject { ["instance_id"] = staleId, ["component_name"] = "BoxCollider" });

Assert.IsNotNull(res["error"], res.ToString());
StringAssert.Contains("GameObject not found", res["error"]["message"].ToString());
}

[Test]
public void UnityComponentManager_Inspect_ReturnsSuccess() {
var go = CreateTestGameObject();
Expand Down
Loading