# PSD 到 Unity

把分層的 PSD 或 PSB 匯入 VberAI Studio，跑自動分層，再匯出到 Unity。

## 先說結論：6個步驟

**PSD 到 Unity** 的主要邏輯是：針對已經分層的 Photoshop 檔案（PSD 或 PSB），要批次化處理好美術素材後，匯入到 Unity 中。[VberAI Studio](https://vberai.com/studio) 匯入這份設計稿，再跑 [自動分層](/docs/sprite/auto-layering-image-to-layers/)：檢測邊緣切圖，匯出有意義命名的圖片檔案，然後選 **Export to Unity**。

已經是 `.fig` 檔案：[Figma 到 Unity](/docs/convert/figma-to-unity/)。還是一張扁平 PNG、需要先分層：[PNG 到 PSD](/docs/convert/png-to-psd/)。

## 步驟 1：開啟分層 PSD

編組要有名字（畫框、按鈕、HUD 條）。這些名字會帶到 VberAI Studio。

![Main Screen UI 的分層 PSD](/images/psd-to-godot/psd_to_godot_step1_psd_file_.webp)

## 步驟 2：在 VberAI Studio 裡匯入 PSD/PSB

在 VberAI Studio 選 **Import → PSD/PSB（匯入 PSD/PSB）**。

![VberAI Studio 匯入入口，選 PSD/PSB](/images/psd-to-godot/psd_to_godot_step2_import_psd_.webp)

## 步驟 3：自動分層

選中畫板（例如 **cat_journey_UI**）。在選中後的工具欄裡開啟重疊圖層，選 **Auto-Layering（自動分層）**。

![重疊圖層選單，含 Auto-Layering 和 Layer Split](/images/auto-layering/step1_auto_layering_.webp)

對話方塊是 **Run AI auto-layering?**，再點 **Start layering**。

![確認對話方塊：Run AI auto-layering，Start layering](/images/auto-layering/step2_confirm_debit_payment_.webp)

帶名字的邊界會出現在圖上，這意味著分層切分的圖片都處理好了。關於這一步驟的詳細說明可以參考 [自動分層](/docs/sprite/auto-layering-image-to-layers/)。

![Auto Layering 結果：貓之旅 UI 上帶命名的邊界](/images/auto-layering/step3_ai_output_.webp)

## 步驟 4：匯出到 Unity

保持已分層的畫板選中（這裡是 **cat_journey_UI_layer**）。開啟 **Export**，選 **Export to Unity**。

![Export 選單，高亮 Export to Unity](/images/psd-to-unity/step_3_export_to_Unity_.webp)

## 步驟 5：選擇匯出到 Unity 的形式

匯出到 Unity 時，可以選匯出形式。對話方塊裡 **Target engine** 是 Unity；格式可以選 **Prefab（.prefab）**。**Export to** 可以選 ZIP 壓縮包，或直接寫到目標工程。**Default paths** 會按引擎預設目錄來放檔案。

![Unity 匯出對話方塊：Prefab 格式與 ZIP 壓縮包](/images/psd-to-unity/step_4_export_settings_.webp)

## 步驟 6：檢查匯出結果

這次選的是 ZIP 壓縮包。解壓後是 `Assets` 總資料夾：`Prefabs` 裡是 Unity 可用的 `.prefab`（組裝好的介面，可以拖進場景）；`Textures` 裡是具體的切圖檔案（按圖層起好名的 PNG）。

![解壓後的 Assets：Prefabs 與 Textures](/images/psd-to-unity/step_5_check_output_.webp)
