agentsclimarketplace

Unity api

Skill bigdra50/unity-cli/skills/unity-api

CLI tool for controlling Unity Editor via command line - Play Mode, console logs, tests, scenes, GameObjects and more

Install
npx -y skills add bigdra50/unity-cli --skill unity-api

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Unity API の探索と実行。u api schema で検索、u api call で任意の public static メソッドを呼ぶ。 Use for: "Unity API 呼び出し", "u api call", "schema 検索", "CLI 非対応操作のフォールバック"

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

2.6 KB, as published. Nobody here has run it

unity-api

PREREQUISITE: ../unity-shared/SKILL.md(Relay Server 経由で Unity Editor が起動/アクティブであること)

skill 経由のコマンドは必ず -i <instance> を付ける (unity-shared #インスタンス指定)。--offline オプションのみ Relay 不要 = -i 不要。

メソッド検索

u -i <instance> api schema --type AssetDatabase          # 型名でフィルタ
u -i <instance> api schema --namespace UnityEditor       # 名前空間でフィルタ
u -i <instance> api schema --method Refresh              # メソッド名で検索
u api schema --offline --type PlayerSettings              # キャッシュから (Relay 不要なので -i 不要)

メソッド呼び出し

u -i <instance> api call UnityEngine.Application get_unityVersion
u -i <instance> api call UnityEditor.AssetDatabase Refresh
u -i <instance> api call UnityEditor.AssetDatabase ImportAsset --params '["Assets/Prefabs/Player.prefab", 0]'
u -i <instance> api call UnityEditor.EditorApplication ExecuteMenuItem --params '["Window/General/Console"]'

よく使うパターン

用途コマンド
プロジェクト設定u -i <instance> api call UnityEditor.PlayerSettings get_productName
コンパイル状態u -i <instance> api call UnityEditor.EditorApplication get_isCompiling
アセット存在確認u -i <instance> api call UnityEditor.AssetDatabase AssetPathExists --params '["Assets/..."]'
フォルダ作成u -i <instance> api call UnityEditor.AssetDatabase CreateFolder --params '["Assets", "New"]'
メニュー実行u -i <instance> api call UnityEditor.EditorApplication ExecuteMenuItem --params '["Tools/..."]'

制約

  • static メソッドのみ
  • 引数: プリミティブ, string, enum, プリミティブ配列
  • UnityEngine / UnityEditor 名前空間のみ
  • [Obsolete] メソッドは除外済み

既存コマンドとの使い分け

既存コマンド (u scene, u build 等) がある操作はそちらを使う。u api は既存コマンドがカバーしない操作のためのフォールバック。

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.