Skip to content

Commit 0e64a51

Browse files
committed
Doc update and duplicate check for LoadSceneAdditive
1 parent 963b517 commit 0e64a51

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

.claude/skills/unity-mcp-skill/references/tools-reference.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,11 @@ manage_components(
352352
# - "Assets/Prefabs/My.prefab" → String shorthand for asset paths
353353
# - "ObjectName" → String shorthand for scene name lookup
354354
# - 12345 → Integer shorthand for instanceID
355+
#
356+
# Sprite sub-asset references (for SpriteRenderer.sprite, Image.sprite, etc.):
357+
# - {"guid": "...", "spriteName": "SubSprite"} → Sprite sub-asset from atlas
358+
# - {"guid": "...", "fileID": 12345} → Sub-asset by fileID
359+
# Single-sprite textures auto-resolve from guid/path alone.
355360
```
356361

357362
---
@@ -543,6 +548,24 @@ manage_prefabs(
543548
position=[0, 1, 0],
544549
components_to_add=["AudioSource"]
545550
)
551+
552+
# Add child GameObjects to a prefab (single or batch)
553+
manage_prefabs(
554+
action="modify_contents",
555+
prefab_path="Assets/Prefabs/Player.prefab",
556+
create_child=[
557+
{"name": "Child1", "primitive_type": "Sphere", "position": [1, 0, 0]},
558+
{"name": "Child2", "primitive_type": "Cube", "parent": "Child1"}
559+
]
560+
)
561+
562+
# Add a nested prefab instance inside a prefab
563+
manage_prefabs(
564+
action="modify_contents",
565+
prefab_path="Assets/Prefabs/Player.prefab",
566+
create_child={"name": "Bullet", "source_prefab_path": "Assets/Prefabs/Bullet.prefab", "position": [0, 2, 0]}
567+
)
568+
# source_prefab_path and primitive_type are mutually exclusive
546569
```
547570

548571
---

MCPForUnity/Editor/Tools/ManageScene.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,10 @@ private static object LoadSceneAdditive(string scenePath)
15161516
if (!File.Exists(Path.Combine(projectRoot, scenePath)))
15171517
return new ErrorResponse($"Scene not found: '{scenePath}'");
15181518

1519+
var existing = SceneManager.GetSceneByPath(scenePath);
1520+
if (existing.IsValid() && existing.isLoaded)
1521+
return new ErrorResponse($"Scene '{existing.name}' is already loaded.");
1522+
15191523
var scene = EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Additive);
15201524
return new SuccessResponse($"Opened '{scene.name}' additively.", new
15211525
{

Server/src/cli/commands/scene.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import Optional, Any
77

88
from cli.utils.config import get_config
9-
from cli.utils.output import format_output, print_error, print_success
9+
from cli.utils.output import format_output, print_error, print_success, print_warning
1010
from cli.utils.connection import run_command, handle_unity_errors
1111

1212

@@ -346,5 +346,7 @@ def validate(repair: bool):
346346
print_success("Scene is clean")
347347
elif repaired > 0:
348348
print_success(f"Found {total} issue(s), repaired {repaired}")
349+
else:
350+
print_warning(f"Found {total} issue(s), none repaired")
349351

350352

0 commit comments

Comments
 (0)