> For the complete documentation index, see [llms.txt](https://docs.witchpot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.witchpot.com/english/basic-info/installation-for-unity.md).

# Installation for Unity

## Preparation

Create a unity URP project with Unity2020 or higher version

<figure><img src="/files/k5yte2fDBA8mcxX31ahp" alt=""><figcaption></figcaption></figure>

## Installation

Download the unitypackage for stable-diffusion-foar-unity from released page

{% embed url="<https://github.com/witchpot-studio/stable-diffusion-for-unity/releases/tag/v1.4.0>" %}

Import the downloaded unitypackage into the Unity project craeted above.

<figure><img src="/files/Qhk5r7EOKzgU7CzYvcla" alt=""><figcaption></figcaption></figure>

After importing, Preferences > StableDiffusion For Unity window will be shown. If not automatically shown, please open from Menu  Edit > Preferences > StableDiffusion For Unity.

<table><thead><tr><th width="121">Type</th><th>About</th></tr></thead><tbody><tr><td>Internal</td><td>Default WebUI. Use this if you are not familiar with StableDiffusion.<br><br>The Witchpot's custom StableDiffusionWebUI will be automatically installed in your C drive user folder.</td></tr><tr><td>External</td><td>If you want to use StableDiffusion WebUI installed and cutomized by yourself.<br><br>Please specify the path to the WebUI's webui-user.bat file in API mode.<br>For more information on installation, please see <a data-mention href="/pages/M3ruAE2L582CNIvxEEPM">/pages/M3ruAE2L582CNIvxEEPM</a></td></tr></tbody></table>

<figure><img src="/files/lkTt9TaS4oeubsrLOSTQ" alt=""><figcaption></figcaption></figure>

press the Witchpot > StartServer button on the menu bar.

<figure><img src="/files/QtmHwwK7lkbGwyXl4k84" alt=""><figcaption></figcaption></figure>

※If nothing starts after pressing StartServer (especially if you have updated stable-diffusion-for-unity), please restart UnityEditor once.

When you start the server, CommandPrompt will open. \
This initial startup will take some time as it is downloading necessary files.

<figure><img src="/files/ESnfWUfbRDhZVrtMHjnJ" alt=""><figcaption></figcaption></figure>

If CommandPrompt displays&#x20;

`Running on local URL:   http://127.0.0.1:7860`

and stops, the installation is complete and you are ready to  generate image.

Open \
Assets\Plugins\Witchpot\Packages\StableDiffusion\Runtime\Settings\StableDiffusionWebUISettings\
and confirm ModelNames and ModelNamesForLora is not empty.

<div align="left"><figure><img src="/files/hj8SqqcHuY4EzbYN5D3U" alt=""><figcaption></figcaption></figure></div>

## Confirm Image Generation

Open2DStageDemo scene

Assets\Plugins\Witchpot\Packages\StableDiffusion\Example\Demo\Scenes\2DStageDemo

<figure><img src="/files/M2DrRJ6YdgLMRpP3auKb" alt=""><figcaption></figcaption></figure>

After Open the scene. Open Canvas > RawImage-Depth2Img and press Generate.

<figure><img src="/files/jCEVPbkdhRmGV2pD04fb" alt=""><figcaption></figcaption></figure>

Image generation progress bar will be shown on Command Prompt when you generating image.

<figure><img src="/files/WgsvRzCpTm233KT8hiJ4" alt=""><figcaption></figcaption></figure>

Texture will be assigned to the RawImage after image generation completed.

<figure><img src="/files/dzCqociDqH8DdByOdWAP" alt=""><figcaption></figcaption></figure>

If an error occurs and you are unable to proceed the image generation, you may have insufficient VRAM. Please lower the resolution or try Text2Img.
