$npx -y skills add bigdra50/unity-cli --skill unity-sceneシーン構築ワークフロー。オブジェクト配置、コンポーネント設定、Prefab化、シーン保存。 Use for: "シーン構築", "オブジェクト配置", "Prefab化", "コンポーネント設定
| 1 | # unity-scene |
| 2 | |
| 3 | > **PREREQUISITE:** `../unity-shared/SKILL.md`(Relay Server 経由で Unity Editor が起動/アクティブであること) |
| 4 | > |
| 5 | > skill 経由のコマンドは必ず `-i <instance>` を付ける (unity-shared #インスタンス指定)。 |
| 6 | |
| 7 | ## ワークフロー |
| 8 | |
| 9 | ```text |
| 10 | 1. 現状把握 u -i <instance> scene active / u -i <instance> scene hierarchy |
| 11 | 2. オブジェクト u -i <instance> gameobject create / find / modify / delete |
| 12 | 3. コンポーネント u -i <instance> component add / modify / inspect / list |
| 13 | 4. Prefab化 u -i <instance> asset prefab <path> --target <name> |
| 14 | 5. シーン保存 u -i <instance> scene save |
| 15 | ``` |
| 16 | |
| 17 | ## コマンドリファレンス |
| 18 | |
| 19 | ### Scene |
| 20 | |
| 21 | ```bash |
| 22 | u -i <instance> scene active # アクティブシーン情報 |
| 23 | u -i <instance> scene hierarchy --depth 2 # 階層表示 |
| 24 | u -i <instance> scene load --path "Assets/..." # シーン読み込み |
| 25 | u -i <instance> scene save # 保存 |
| 26 | ``` |
| 27 | |
| 28 | ### GameObject |
| 29 | |
| 30 | ```bash |
| 31 | u -i <instance> gameobject create "Player" # 空オブジェクト |
| 32 | u -i <instance> gameobject create "Cube" --primitive Cube # プリミティブ |
| 33 | u -i <instance> gameobject find --name "Player" # 検索 |
| 34 | u -i <instance> gameobject modify -n "Player" --position 0,1,0 # Transform変更 |
| 35 | u -i <instance> gameobject delete -n "Player" # 削除 |
| 36 | ``` |
| 37 | |
| 38 | ### Component |
| 39 | |
| 40 | ```bash |
| 41 | u -i <instance> component list -t "Player" # 一覧 |
| 42 | u -i <instance> component inspect -t "Player" -T Rigidbody # 詳細 |
| 43 | u -i <instance> component add -t "Player" -T Rigidbody # 追加 |
| 44 | u -i <instance> component modify -t "Player" -T Rigidbody --prop mass --value 2 # 変更 |
| 45 | u -i <instance> component remove -t "Player" -T Rigidbody # 削除 |
| 46 | ``` |
| 47 | |
| 48 | ### Asset |
| 49 | |
| 50 | ```bash |
| 51 | u -i <instance> asset prefab "Assets/Prefabs/Player.prefab" --target "Player" # Prefab化 |
| 52 | u -i <instance> asset info "Assets/Prefabs/Player.prefab" # 情報 |
| 53 | ``` |
| 54 | |
| 55 | ## CLI 非対応操作 |
| 56 | |
| 57 | unity-shared のフォールバック順に従う: |
| 58 | 1. `u -i <instance> api schema --type <Type>` で対応メソッドを検索 |
| 59 | 2. `u -i <instance> api call` で実行 |
| 60 | 3. .meta インポート設定等は YAML 直接編集 |