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);