Unityゲーム画面用のFigma Make(Figma AI)投入プロンプトを壁打ちで設計・生成する。UI Toolkit(UXML/USS)への変換を見据えた制約込み。ユーザーが「Figma用のプロンプトを作りたい」「画面デザインの壁打ちをしたい」と言ったら使う。
The English summary is being prepared. Showing the original description.
デザイン(Figma MCP出力・HTML/CSS・デザイン仕様)からUI Toolkit用UXML/USSを生成し、Unityへのインポート・シーン配置・コンパイル・スクショ検証・ゲームロジック結線検証まで自動で行う。「この画面をUnityに取り込んで」「UXML/USSにして」で使う。
The English summary is being prepared. Showing the original description.
See how to installReview the instructions the agent will receive before you install.
デザインソースからUnityで表示・動作確認済みのUXML/USSを作るまでの全工程。
uloop-compile / uloop-screenshot / uloop-execute-dynamic-code 等の同梱スキルを使う)uloop-uitk-interact スキル参照。renderingモードはUI Toolkitが正しく写らず、simulate-mouse系はUI Toolkitに届かない)get_metadata で選択フレームの width/height を確認。Game Viewの検証解像度(推奨1920x1080)と不一致なら中断し、Figma側でのリサイズを人間に依頼する(一致しないとピクセル比較が成立しない)docs/design-refs/<画面名>.png)に人間がFigmaからエクスポートしたPNG(1x・検証解像度と同サイズ)があるか確認。無ければ人間に依頼する(Figmaで対象フレームを右クリック→Export)
get_screenshot はチャット内でしか画像を見られずファイル保存できない。目視比較には使ってよいが、正解画像の代わりに自作のHTML再現を使うことは禁止(自分の再現物と照合する循環評価になり、ground truthが失われる)get_variable_defs → get_design_context(get_code) → get_screenshot(目視用)
get_variable_defs が {} なのは正常系(Figma Make生成物はFigma Variablesを持たない)。トークンの正は次の優先順で採用する: ①壁打ちで確定したデザイン選好ドキュメント(例: docs/デザイン選好.md) ②get_design_contextのCSS実測値デザインの要素一覧と機能要件を突き合わせ、要件にない要素を列挙する(例: 設定/実績ボタン・装飾的な統計表示など、生成AIが自主的に追加しがちな要素)。各要素を 残す(装飾) / 消す / ロジック結線する のいずれにするか人間に確認してから実装する(プロジェクト側で方針が決まっていればそれに従う)。
動的生成コードとの契約ズレも同時に確認する: デザインの構造(例: リスト行のアイコン・レート表示・バッジ)が、実行時にコードが生成する構造より豊かな場合、デザイン側を先回りして貧しくしない。人間に確認の上、このワークフローの中でコントローラ側の生成コードを拡張し、手順5の結線検証で確かめる。
演出仕様も要件として取り込む: アニメーション・エフェクト(押下時スケール、カウント加算の浮遊表示等)は、デザインを静的ファイルに貼り出した時点で失われておりMCPからは取得できない。壁打ちログ等の演出仕様(どの操作で何がどう動くか)を確認し、USSの transition / コントローラ側実装としてこのワークフローの中で実装する。演出仕様が文書に無ければ人間に確認する。
:root { --color-primary: #xxxxxx; } → color: var(--color-primary);(var()は関数の中では使えない点に注意)Assets/_Project/UI/<画面名>.uxml / <画面名>.uss)⚙ではなく⚙️=U+FE0F付き).root { -unity-font-definition: url("../Fonts/YourFont-Regular.ttf"); }
:hover / :active + transition で再現する(例: .main-button { transition: scale 0.08s ease-out; } .main-button:active { scale: 0.92; })既存シーンは変更しない。 検証は専用シーン(例: Assets/_Project/Scenes/UITKImportTest.unity)で行う。
以下のcsxをテンプレートとして execute-dynamic-code --code-file で実行する(__UXML_PATH__ / __SCENE_PATH__ / __PANEL_SETTINGS_PATH__ / __THEME_PATH__ を差し替え)。
注意: csx内に絵文字リテラルを書くと不安定。絵文字が必要な場合は \U0001F359 形式のエスケープを使う。
using UnityEngine;
using UnityEditor;
using UnityEngine.UIElements;
using UnityEditor.SceneManagement;
AssetDatabase.Refresh();
string uxmlPath = "__UXML_PATH__"; // 例: Assets/_Project/UI/TitleScreen.uxml
string scenePath = "__SCENE_PATH__"; // 例: Assets/_Project/Scenes/UITKImportTest.unity
string panelSettingsPath = "__PANEL_SETTINGS_PATH__"; // 例: Assets/_Project/UI/ScreenPanelSettings.asset
string themePath = "__THEME_PATH__"; // 例: Assets/_Project/UI/UnityDefaultRuntimeTheme.tss
// 検証用シーンを開く(なければ新規作成して保存)
// ※必ずシーン切替を先に行うこと。シーン切替(NewScene/OpenScene)の前に取得したアセット参照を
// 切替後のオブジェクトに代入すると、保存時に参照が失われることがある(実測)
var scene = EditorSceneManager.GetActiveScene();
if (scene.path != scenePath)
{
if (AssetDatabase.LoadAssetAtPath<SceneAsset>(scenePath) == null)
{
var newScene = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single);
EditorSceneManager.SaveScene(newScene, scenePath);
scene = newScene;
}
else
{
scene = EditorSceneManager.OpenScene(scenePath);
}
}
// PanelSettings(共用アセットを再利用、なければ作成)— シーン切替の後に読み込む
var panelSettings = AssetDatabase.LoadAssetAtPath<PanelSettings>(panelSettingsPath);
if (panelSettings == null)
{
var theme = AssetDatabase.LoadAssetAtPath<ThemeStyleSheet>(themePath);
panelSettings = ScriptableObject.CreateInstance<PanelSettings>();
panelSettings.themeStyleSheet = theme;
panelSettings.scaleMode = PanelScaleMode.ScaleWithScreenSize;
panelSettings.referenceResolution = new Vector2Int(1920, 1080);
AssetDatabase.CreateAsset(panelSettings, panelSettingsPath);
}
var existing = GameObject.Find("ImportedUI");
if (existing != null) Object.DestroyImmediate(existing);
var go = new GameObject("ImportedUI");
var uiDoc = go.AddComponent<UIDocument>();
uiDoc.panelSettings = panelSettings;
uiDoc.visualTreeAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxmlPath);
EditorSceneManager.MarkSceneDirty(scene);
EditorSceneManager.SaveOpenScenes();
return "scene=" + scene.path + ", uxml=" + (uiDoc.visualTreeAsset != null);
csx実行後、PlayModeに入る前に参照が保存されたか確認する(execute-dynamic-codeで
doc.panelSettings != null && doc.visualTreeAsset != null をチェック)。nullならシーンを開いた状態で再代入して保存する。
症状: panelSettingsがnullのままPlayすると、エラーも出ずにUIが一切描画されない。
npx --yes uloop-cli@<バージョン> compile --project-path <proj>
npx --yes uloop-cli@<バージョン> control-play-mode --action Play --project-path <proj>
npx --yes uloop-cli@<バージョン> screenshot --window-name Game --output-directory <スクショ保存先> --project-path <proj>
自己評価は必須ゲート(スクショを撮らずに完了と言わない)。正解画像は手順0で確認した人間エクスポートのPNGを使い、以下の4観点を別々に評価する:
不一致があればUSS/UXMLを修正して手順4を繰り返す(最大5回。収束しない場合は人間にエスカレーション)。
UIは表示できてもゲームロジックが付いていなければ動作確認になっていない。
ImportedUI にプロジェクト指定のコントローラ(例: ClickerScreenController)を AddComponent で付与するuloop-uitk-interact の方式(SendEvent)でクリック等の操作を実行し、ラベル値をreturnで検証する(要素名・クラス契約がC#と噛み合うかの確認):active などの押下表現・演出(浮遊テキスト等)はSendEventや静止画では確認しきれない。演出仕様との照合を人間レビュー項目として明記し、実装漏れがないかレビュー依頼時に列挙するcontrol-play-mode --action Stop)feat(ui): <画面名>のUXML/USS生成 → feat(ui): <画面名>検証OK などNo reviews yet. Tell others what you thought.
No login needed. Share how it worked for you, ask a question, or note where it did not run.
No comments yet. Be the first to write one.
Unityゲーム画面用のFigma Make(Figma AI)投入プロンプトを壁打ちで設計・生成する。UI Toolkit(UXML/USS)への変換を見据えた制約込み。ユーザーが「Figma用のプロンプトを作りたい」「画面デザインの壁打ちをしたい」と言ったら使う。
The English summary is being prepared. Showing the original description.
Clear Unity Console entries. Use before compile, tests, or debugging when stale logs would hide the current result.
The English summary is being prepared. Showing the original description.
Compile the Unity project and report errors/warnings. Use after C# edits or when a full Domain Reload compile is needed.
The English summary is being prepared. Showing the original description.
Control Unity Editor Play Mode. Use to start, stop, or pause Play Mode for runtime behavior checks and frame inspection.
The English summary is being prepared. Showing the original description.
Execute C# with Unity APIs when existing uloop tools cannot inspect or edit enough. Use for scene, prefab, SerializedObject, AssetDatabase refresh/.meta generation, menu, or PlayMode automation.
The English summary is being prepared. Showing the original description.
Find or inspect Unity GameObjects, especially objects the user currently selected in the Hierarchy. Use for details, components, tags, layers, or name/path searches.
The English summary is being prepared. Showing the original description.