| name | unity-cli-bridge |
| description | Use when the user wants to operate Unity through Unity CLI Bridge (`unity-cli`/`ucli`), including live command selection, asset commands, scene/prefab inspect/patch flows, QA test automation (Play Mode input simulation), console-log verification, or Unity CLI Bridge troubleshooting. |
Unity CLI Bridge
unity-cli๋ฅผ ์ค์ ์์
์ ์์ ํ๊ฒ ์ฐ๊ธฐ ์ํ ์ด์ฉ ์คํฌ์ด๋ค. ๋ชฉ์ ์ ๋ช
๋ น์ด ๋ชฉ๋ก์ ๊ธธ๊ฒ ๋์ดํ๋ ๊ฒ์ด ์๋๋ผ, ํ์ฌ ํ๋ก์ ํธ๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ์ก๊ณ , ๋ง๋ ๋ช
๋ น์ ๊ณ ๋ฅด๊ณ , ์์
๋ค ๋ก๊ทธ๊น์ง ํ์ธํ๋ ํ๋ฆ์ ๊ณ ์ ํ๋ ๊ฒ์ด๋ค.
์ด ์คํฌ์ Unity ํจํค์ง com.yhc509.unity-cli-bridge v{{PACKAGE_VERSION}}์ ํฌํจ๋์ด ์ค์น๋์๋ค. ํจํค์ง๋ฅผ ์
๋ฐ์ดํธํ๋ค๋ฉด Unity์ Window > Unity CLI Manager์์ ์คํฌ๋ ๋ค์ ์ค์นํ๋ค.
Quick Workflow
- ์คํ ํ์ผ์ ์ฐพ๋๋ค.
- ๋์ ํ๋ก์ ํธ๋ฅผ ๊ฒฐ์ ํ๊ณ
--project๋ฅผ ํญ์ ๋ช
์ํ๋ค.
- ์ฐ๊ธฐ ์์
์ ์๋ ์ํ๋ฅผ ๋ณธ๋ค.
- ๋จผ์
status --json --project <name>์ผ๋ก live ์ฐ๊ฒฐ, busy ์ํ, ํ์ฌ ํ๋ก์ ํธ๊ฐ ๋ง๋์ง ํ์ธํ๋ค.
- ์๋ต์
projectName์ด ์๋ํ ํ๋ก์ ํธ๊ฐ ๋ง๋์ง ๋ฐ๋์ ํ์ธํ๋ค.
- ์์
์ข
๋ฅ์ ๋ง๋ ํ๋ฆ์ ๊ณ ๋ฅธ๋ค.
- ์ผ๋ฐ ๋ช
๋ น, ์์
์์
, scene inspect/patch๋
references/command-flows.md
- ํ๋ฆฌํน ์กฐ๋ฆฝ๊ณผ patch spec์
references/prefab-workflows.md
- ๋ฌธ์ ํด๊ฒฐ์
references/troubleshooting.md
- ์์
๋ค์๋ ๋ฐ๋์ ๊ฒ์ฆํ๋ค.
- live ์์
๋ค ๊ฒ์ฆ ๋ฃจํด๊ณผ
read-console --no-stacktrace --output compact ํจํด์ references/command-flows.md์ ๊ฒ์ฆ ๋ฃจํด์ ๋ฐ๋ฅธ๋ค.
Operating Rules
- ๋ชจ๋ asset ๊ฒฝ๋ก๋
Assets/... ํ์์ผ๋ก ๋ค๋ฃฌ๋ค. ์กฐํ ์ ์ฉ(asset find, asset info)์ Packages/...๋ ํ์ฉ๋๋ค.
- ํ๊ดด ์ฐ์ฐ๊ณผ ๋ฎ์ด์ฐ๊ธฐ๋
--force๊ฐ ์์ ๋๋ง ํ์ฉ๋๋ค๊ณ ๊ฐ์ ํ๋ค.
execute --code 'Debug.Log(__pucArgsJson);' --args '{"k":"v"}' --force๋ก ๋๊ธด JSON์ ์ฌ์ฉ์ ์ฝ๋์์ __pucArgsJson ๋ฌธ์์ด ๋ณ์๋ก ์ฝ๋๋ค.
execute --args ์ฌ์ฉ์ ์ฝ๋์์๋ wrapper ์์ฝ prefix์ธ __puc_internal_* ๋ณ์๋ฅผ ์ ์ธํ์ง ์๋๋ค.
execute --args ๊ฐ์๋ secret/credential์ ๋ฃ์ง ์๋๋ค. CodeDOM ์ปดํ์ผ ์ค OS temp์ .cs ํ์ผ์ด ์ ์ ์์ฑ๋ ์ ์๋ค.
- LLM์ด ์๋นํ๋ ๋ช
๋ น์๋
--output compact๋ฅผ ๊ธฐ๋ณธ์ผ๋ก ๋ถ์ธ๋ค. ์ด์ ์ ์์ธ๋ references/command-flows.md์ ์ํ ํ์ธ ์ ์ค๋ช
์ ๋ฐ๋ฅธ๋ค.
scene patch ์ ์๋ ๊ฐ๋ฅํ๋ฉด scene inspect --with-values๋ฅผ ๋จผ์ ์คํํด์ GameObject path์ field ์ด๋ฆ์ ํ์ธํ๋ค.
prefab patch ์ ์๋ ๊ฐ๋ฅํ๋ฉด prefab inspect --with-values๋ฅผ ๋จผ์ ์คํํด์ path์ field ์ด๋ฆ์ ํ์ธํ๋ค.
- inspect ์๋ต์ด ํด ๋๋
--max-depth N์ผ๋ก ๊น์ด๋ฅผ ์ ํํ๊ณ --omit-defaults๋ก ๊ธฐ๋ณธ๊ฐ์ ์๋ตํ๋ค. --with-values์๋ ํญ์ --omit-defaults๋ฅผ ํจ๊ป ๋ถ์ฌ 0/null/false/๋น ๊ฐ ๊ธฐ๋ณธ๊ฐ์ ์๋ผ๋ธ๋ค(์ปดํฌ๋ํธ๋น 30~55% ์ ์ฝ).
material info๋ --omit-defaults๋ฅผ ์ง์ํ๋ค. URP/Lit ๊ธฐ์ค 48๊ฐ ์์ฑ โ ๋ณ๊ฒฝ๋ ๊ฒ๋ง ๋ฐํํ์ฌ ํ ํฐ์ 71% ์ ์ฝํ๋ค.
--omit-defaults ๊ฒฐ๊ณผ๋ read-only์ด๋ค. patch input์ผ๋ก ๊ทธ๋๋ก ์ฐ๋ฉด ์๋ต๋ ํ๋๊ฐ ๋ณต์๋์ง ์๋๋ค.
SerializedProperty.propertyPath๋ ์ถ์ธกํ์ง ๋ง๊ณ inspect ๊ฒฐ๊ณผ๋ฅผ ๊ธฐ์ค์ผ๋ก ์ด๋ค.
- live ํธ์ง ๋ช
๋ น์ด compile/update ์ค์ด๋ฉด ์ฝ๊ธฐ ์ ์ฉ ๋ช
๋ น๋ง ๋จ๊ธฐ๊ณ ๋๋จธ์ง๋ ์ฌ์๋ ํ๋ฆ์ผ๋ก ๋ณธ๋ค.
PROTOCOL_MISMATCH๋ ๋ณดํต CLI๊ฐ ์ค์ค๋ก ํด๊ฒฐํ๋ค. ๋์ ํ๋ก์ ํธ์ ๋ธ๋ฆฟ์ง๊ฐ ๋ค๋ฅธ wire protocol์ ์ฐ๋ฉด, CLI๊ฐ ๊ทธ protocol์ ๋งํ๋ ์ค์น๋ณธ์ผ๋ก ์๋ ์ ํํด ๊ฐ์ ๋ช
๋ น์ ๋ค์ ์คํํ๋ค(์์ด์ ํธ๊ฐ ํ ์ผ ์์). ๊ทธ๋๋ ์ด ์๋ฌ๊ฐ ๋์์๋ค๋ฉด ํด๋น protocol์ ๋งํ๋ CLI๊ฐ ์ค์น๋ผ ์์ง ์๋ค๋ ๋ป์ด๋ค. ์ฌ์๋๋ก ํ๋ฆฌ์ง ์์ผ๋ฏ๋ก, ์ฌ์ฉ์์๊ฒ ๊ทธ ํ๋ก์ ํธ์ Unity Editor์์ Window > Unity CLI Manager > Install CLI๋ฅผ ์คํํ๋๋ก ์์ฒญํ๋ค.
package list/add/remove/search๋ bridge์์ ๋น์ฐจ๋จ์ผ๋ก ์ฒ๋ฆฌ๋๋ค. PACKAGE_TIMEOUT์ด ๋์ค๋ฉด Package Manager๊ฐ 300์ด ์์ ์๋ตํ์ง ์์ ์ํ์ด๋ฏ๋ก Editor์ Package Manager ์ํ๋ฅผ ํ์ธํ ๋ค ์ฌ์๋ํ๋ค.
- scene path๋
/Root[0]/Child[0] ํ์์ผ๋ก ์ฐ๊ณ /๋ virtual scene root๋ก ๋ณธ๋ค.
- root prefab ์ด๋ฆ์ Unity ์ ์ฅ ๊ท์น ๋๋ฌธ์ ํ์ผ ์ด๋ฆ์ผ๋ก ์ ๊ทํ๋๋ค๊ณ ๊ฐ์ ํ๋ค.
screenshot์ --view ์๋ต ์ game์ด ๊ธฐ๋ณธ์ด๋ค. Scene View๊ฐ ํ์ํ๋ฉด --view scene์ ๋ช
์ํ๋ค.
- ์์ด์ ํธ๊ฐ ์ฝ์ ์คํฌ๋ฆฐ์ท์
--format jpg --quality 75 --max-width 1024๋ฅผ ๊ธฐ๋ณธ์ผ๋ก ๋ถ์ธ๋ค. ๊ธฐ๋ณธ PNG full-resolution์ ์ด๋ฏธ์ง ํ ํฐ์ ํฌ๊ฒ ์๋นํ๋ค(1080p ๊ธฐ์ค ~72% ์ ์ฝ). lossless๊ฐ ํ์ํ ๋๋ง --format png.
- Play Mode ์์์ ๋จ๊ฒจ์ผ ํ๋ฉด
record start --duration N --wait --path /tmp/out.mp4๋ฅผ ์ด๋ค. ์๋ ๋
นํ๋ record start ํ record status, record stop ์์๋ก ์ข
๋ฃํ๋ค. record start๋ Play Mode ์ ์ฉ์ด๋ฉฐ Unity Recorder dependency๊ฐ ํ์ํ๋ค.
qa tap --x --y์๋ screenshot์์ ํ์ธํ ์ด๋ฏธ์ง ์ขํ๋ฅผ ๊ทธ๋๋ก ๋ฃ๋๋ค. ์๋ต์ imageOrigin์ top-left, coordinateOrigin์ bottom-left๋ค.
- ๋ณ๋ Y-flip์ด๋ ํด์๋ ์ค์ผ์ผ ๋ณํ์ ํ์ง ์๋๋ค. Bridge๊ฐ ๋ง์ง๋ง
screenshot ํฌ๊ธฐ ๋๋ ๋ช
์ํ --screenshot-width/--screenshot-height๋ฅผ ๊ธฐ์ค์ผ๋ก ๋ด๋ถ ์ฒ๋ฆฌํ๋ค.
- ์ขํ๋ฅผ ์ถ์ธกํ์ง ๋ง๊ณ ํญ ๋์์ ๋จผ์ ์ด๊ฑฐํ๋ค: uGUI ๋ฒํผ์
qa ui-dump --limit 30 --interactable-only --omit-rect --output compact, ๋น-UI ์๋ ์ค๋ธ์ ํธ(์ ํฌ ๊ทธ๋ฆฌ๋ ์ ๋ ๋ฑ)๋ qa world-dump --limit 30 --output compact. ์ฐพ์ ํ
์คํธ/๋ผ๋ฒจ์ ์๋ฉด --text <substring>์ผ๋ก ์๋ฒ์ฌ์ด๋ ํํฐ๋งํ๋ค. ๋ ๋ค centerX/centerY ์ด๋ฏธ์ง ์ขํ๋ฅผ ๊ทธ๋๋ก ๋ฐํํ๋ฉฐ, ๋ํ ํ๋ฉด dump์์๋ envelope ์ ๊ฑฐ ํจ๊ณผ๊ฐ ํนํ ํฌ๋ค.
qa world-dump๋ ๊ฒ์์ด opt-inํ ์ค๋ธ์ ํธ๋ง ๋ณธ๋ค: ๊ฒ์ ์ปดํฌ๋ํธ๊ฐ UnityCliBridge.Bridge.IQaTappable์ ๊ตฌํํ๊ฑฐ๋ QaTappable ๋ง์ปค๋ฅผ ๋ถ์ฐฉํด์ผ ํ๋ค. ํ๋ฉด ๋ฐ์ --include-offscreen์ ์ค ๋๋ง ํฌํจ๋๋ค.
- ์ด๊ฑฐ๋ ์๋ ์ค๋ธ์ ํธ๋
qa tap --target <path>๋ก ํญํ๋ค. ์ค๋ธ์ ํธ์ TryQaTap()์ด ์ฒ๋ฆฌํ๋ฉด ๊ทธ๋๋ก, ์๋๋ฉด anchor ์ขํ์ Input System ํญ์ ์ฃผ์
ํ๋ค โ qa tap --x --y(EventSystem)๊ฐ ๋ฟ์ง ์๋ raw Input System polling ์
๋ ฅ์๋ ๋๋ฌํ๋ค. ๊ฐ์ ์ด๋ฆ ํ์ ๋ ์ฒซ ๋งค์น๋ก๋ง ์กํ๋ ๊ณ ์ ์ด๋ฆ/label์ ๋ถ์ฌํ๋ค. ์์ธ๋ references/qa-testing.md.
- ์กฐ๊ฑด ๋๊ธฐ์ ๋ค๋จ๊ณ ์
๋ ฅ์
qa run-sequence --spec-json @file๋ก ํ ๋ฒ์ ๋ณด๋ธ๋ค. ์์์ด ํ์ํ๋ฉด --record --record-path /tmp/seq.mp4๋ฅผ ๋ถ์ฌ sequence ๊ตฌ๊ฐ๋ง mp4๋ก ๋จ๊ธด๋ค. ์์ธ๋ references/qa-testing.md.
Script Workflow (No Dedicated Commands)
unity-cli does not have dedicated script create/delete commands. Use this combination:
Create/modify script:
- Write .cs file directly to the Assets/ folder via filesystem
unity-cli refresh โ trigger AssetDatabase refresh
unity-cli compile โ request script compilation
unity-cli read-console --type error โ check for compile errors
Delete script:
unity-cli asset delete --path Assets/Scripts/MyScript.cs --force
(handles .meta cleanup and refresh automatically)
Component Operations
List components on a node:
unity-cli scene list-components --node "/Player[0]"
unity-cli prefab list-components --path Assets/Prefabs/Player.prefab --node "/Root[0]"
Add component (with optional initial values):
unity-cli scene add-component --path Assets/Scenes/S.unity --node "/Player[0]" --type Rigidbody --values '{"mass":5,"damping":1}'
unity-cli prefab add-component --path Assets/Prefabs/P.prefab --node "/Root[0]" --type BoxCollider
Remove component:
unity-cli scene remove-component --path Assets/Scenes/S.unity --node "/Player[0]" --type BoxCollider --force
unity-cli prefab remove-component --path Assets/Prefabs/P.prefab --node "/Root[0]" --type BoxCollider --force
Friendly key mapping: Rigidbody, Collider, Renderer, Light, and Camera values accept common keys like mass, damping, isTrigger, materials[0], shadowStrength, and fieldOfView, which resolve to Unity SerializedProperty.propertyPath values. If a key is not found, use list-components then inspect --with-values.
Convenience Commands โ ํธ์ ๋ช
๋ น ์ฐ์ ์ฌ์ฉ ์์น
์๋ ์์
์๋ scene patch --spec-json ๋์ ์ ์ฉ ํธ์ ๋ช
๋ น์ ์ฐ์ ์ฌ์ฉํ๋ค. ํธ์ถ ํ์์ ํ ํฐ์ ์ ์ฝํ ์ ์๋ค.
| ์์
| ํธ์ ๋ช
๋ น | ๋์ฒดํ๋ ๋ฐฉ์ |
|---|
| ํ๋ฆฌ๋ฏธํฐ๋ธ GO ์ถ๊ฐ | scene add-object --primitive Cube --parent ... --position x,y,z | add-object (๋น GO) + inspect + patch Transform 3๋จ๊ณ |
| Transform ์์ | scene set-transform --node ... --position/--rotation/--scale | scene patch modify-component |
| ๋จธํฐ๋ฆฌ์ผ ํ ๋น | scene assign-material --node ... --material Assets/... | inspect + scene patch m_Materials.Array.data[0] |
| ํ์
๊ธฐ๋ฐ ์์
๊ฒ์ | asset find --type Material | --name ํ์์์ |
scene add-object ์๋ต์๋ createdPath๊ฐ ํฌํจ๋๋ฏ๋ก, ํ์ ๋ช
๋ น์์ ๋ณ๋ inspect ์์ด ๋ฐ๋ก ๊ฒฝ๋ก๋ฅผ ์ฌ์ฉํ ์ ์๋ค.
- scene/prefab hierarchy node๋ฅผ ๊ฐ๋ฆฌํค๋ ํธ์ ๋ช
๋ น์
--node๋ฅผ ์ฌ์ฉํ๋ค. JSON patch spec ๋ด๋ถ ํ๋๋ ๊ณ์ target/parent๋ฅผ ์ฌ์ฉํ๋ค.
set-node์์ ์ธ์ ์ ๋๋ ํค๋ฅผ ๋ฃ์ผ๋ฉด warnings ํ๋๋ก ๊ฒฝ๊ณ ๊ฐ ๋ฐํ๋๋ค. ๋ชจ๋ ํค๊ฐ ์คํจํ๋ฉด patched: false๊ฐ ๋๋ค.
What To Read Next