From 298e35c50be1f7c6e291231b267bc76121d52396 Mon Sep 17 00:00:00 2001 From: jklee Date: Sun, 14 Jun 2026 20:20:26 +0900 Subject: [PATCH] =?UTF-8?q?tweak:=20=EC=9E=85=EA=B3=A0=20=EB=8F=99?= =?UTF-8?q?=EC=84=A0=20=EB=8B=A8=EC=B6=95=20(=EB=B0=95=EC=8A=A4=20z=3D-1?= =?UTF-8?q?=20/=20=EC=8A=AC=EB=A1=AF=20z=3D1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 플레이어 스폰 양옆으로 박스·슬롯을 바짝 배치해 왕복 거리 축소. setup 재실행 시 기존 오브젝트 위치도 갱신되도록 변경. Co-Authored-By: Claude Opus 4.8 (1M context) --- Assets/Scripts/Editor/PickupDemoSetup.cs | 29 +++++++++++++++--------- Assets/Scripts/Editor/SlotSetup.cs | 15 ++++++++---- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Assets/Scripts/Editor/PickupDemoSetup.cs b/Assets/Scripts/Editor/PickupDemoSetup.cs index 06979c1..5635367 100644 --- a/Assets/Scripts/Editor/PickupDemoSetup.cs +++ b/Assets/Scripts/Editor/PickupDemoSetup.cs @@ -39,19 +39,26 @@ namespace SinoWms.EditorTools for (int i = 0; i < 4; i++) { string objName = $"Box_{i + 1}"; - if (container.transform.Find(objName) != null) continue; + var existing = container.transform.Find(objName); - var box = GameObject.CreatePrimitive(PrimitiveType.Cube); - box.name = objName; - box.transform.SetParent(container.transform, false); - box.transform.localPosition = new Vector3(-3f + i * 2f, 0.5f, -20f); - box.transform.localScale = Vector3.one; - box.GetComponent().sharedMaterial = MakeMaterial(colors[i]); + GameObject box; + if (existing != null) + { + box = existing.gameObject; + } + else + { + box = GameObject.CreatePrimitive(PrimitiveType.Cube); + box.name = objName; + box.transform.SetParent(container.transform, false); + box.transform.localScale = Vector3.one; + box.GetComponent().sharedMaterial = MakeMaterial(colors[i]); + box.AddComponent().mass = 1f; + box.AddComponent().displayName = names[i]; + } - var rb = box.AddComponent(); - rb.mass = 1f; - - box.AddComponent().displayName = names[i]; + // 위치는 항상 갱신(동선 단축 — 플레이어 스폰 바로 남쪽) + box.transform.localPosition = new Vector3(-3f + i * 2f, 0.5f, -1f); } EditorSceneManager.MarkSceneDirty(player.scene); diff --git a/Assets/Scripts/Editor/SlotSetup.cs b/Assets/Scripts/Editor/SlotSetup.cs index 02bd402..8e53c2d 100644 --- a/Assets/Scripts/Editor/SlotSetup.cs +++ b/Assets/Scripts/Editor/SlotSetup.cs @@ -14,10 +14,10 @@ namespace SinoWms.EditorTools // 슬롯 위치와 기대 품목 (PickupDemoSetup의 박스 이름과 일치시켜 정답 구성) private static readonly (Vector3 pos, string expected)[] Slots = { - (new Vector3(-6f, 0.03f, 8f), "박스 A (생수)"), - (new Vector3(-2f, 0.03f, 8f), "박스 B (우유)"), - (new Vector3(2f, 0.03f, 8f), "박스 C (라면)"), - (new Vector3(6f, 0.03f, 8f), "박스 D (잡화)"), + (new Vector3(-3f, 0.03f, 1f), "박스 A (생수)"), + (new Vector3(-1f, 0.03f, 1f), "박스 B (우유)"), + (new Vector3(1f, 0.03f, 1f), "박스 C (라면)"), + (new Vector3(3f, 0.03f, 1f), "박스 D (잡화)"), }; [MenuItem("SinoWMS/Setup Slots")] @@ -28,7 +28,12 @@ namespace SinoWms.EditorTools for (int i = 0; i < Slots.Length; i++) { string slotName = $"Slot_{i + 1}"; - if (container.transform.Find(slotName) != null) continue; + var existing = container.transform.Find(slotName); + if (existing != null) + { + existing.localPosition = Slots[i].pos; // 위치만 갱신 + continue; + } var slotGo = new GameObject(slotName); slotGo.transform.SetParent(container.transform, false);