{"id":35145092,"url":"https://github.com/amin-hp/unity-comfyui-bridge","last_synced_at":"2026-04-29T03:06:39.375Z","repository":{"id":327481928,"uuid":"1109470706","full_name":"Amin-HP/Unity-ComfyUI-Bridge","owner":"Amin-HP","description":"A runtime bridge connecting Unity to ComfyUI. Execute workflows for Image, Audio, and 3D Model generation with support for RenderTextures and a non-blocking queue system.","archived":false,"fork":false,"pushed_at":"2026-02-25T15:13:38.000Z","size":678,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-25T18:52:32.491Z","etag":null,"topics":["ai","comfyui","generative","runtime","unity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Amin-HP.png","metadata":{"files":{"readme":"Readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-03T21:12:29.000Z","updated_at":"2026-02-25T15:14:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Amin-HP/Unity-ComfyUI-Bridge","commit_stats":null,"previous_names":["amin-hp/unity-comfyui-bridge"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Amin-HP/Unity-ComfyUI-Bridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amin-HP%2FUnity-ComfyUI-Bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amin-HP%2FUnity-ComfyUI-Bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amin-HP%2FUnity-ComfyUI-Bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amin-HP%2FUnity-ComfyUI-Bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amin-HP","download_url":"https://codeload.github.com/Amin-HP/Unity-ComfyUI-Bridge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amin-HP%2FUnity-ComfyUI-Bridge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32408456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T02:37:21.628Z","status":"ssl_error","status_checked_at":"2026-04-29T02:36:50.947Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","comfyui","generative","runtime","unity"],"created_at":"2025-12-28T13:38:39.065Z","updated_at":"2026-04-29T03:06:39.369Z","avatar_url":"https://github.com/Amin-HP.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Unity ComfyUI Bridge**\n![header](./header.png)\n\nA robust, node-based integration tool that connects Unity to ComfyUI at runtime. This asset allows you to generate Images, 3D Models (GLB), and Audio, or manipulate RenderTextures directly inside your game or application using the ComfyUI API.\n\n## **Features**\n\n* **Workflow Engine:** A single component that supports Text-to-Image, Image-to-Image, Inpainting, Audio Generation, and 3D Model generation.  \n* **Node-Based Configuration:** Configure Prompts, Seeds, Steps, and Input Images using a visual list in the Unity Inspector.\n\n* **Runtime Queue System:** \"Fire and forget\" execution queue handles multiple requests sequentially without freezing the game.  \n* **RenderTexture Support:** Pipe your Unity Camera output directly into ComfyUI as an input image.  \n* **Output Types:**  \n  * Image (Texture2D / RawImage)  \n  * RenderTexture (Blits result to a target RT)  \n  * Audio (WAV/MP3/FLAC support)  \n  * Object3D (Spawns GLTF/GLB models at runtime)\n\n## **Dependencies**\n\nThis asset requires the following packages installed via Unity Package Manager:\n\n1. **Newtonsoft Json** (com.unity.nuget.newtonsoft-json) \\- For parsing API data.  \n2. **glTFast** (com.unity.cloud.gltfast) \\- For loading 3D models at runtime.\n\n## **Installation**\n\n1. Copy the ComfyUI\\_Bridge folder into your project's Assets folder (or install via UPM/Git).  \n2. Ensure you have the dependencies installed.  \n3. Save your ComfyUI workflows as **API Format (JSON)**.  \n   * *In ComfyUI: Click Settings (Gear Icon) \\-\\\u003e Enable \"Enable Dev mode Options\".*  \n   * *Click \"Save (API Format)\" button.*  \n4. Place your .json workflow files into Assets/StreamingAssets/Workflows/.\n\n## **Core Files Structure**\n\nEnsure your plugin folder looks like this:\n\n```\nComfyUI\\_Bridge/  \n├── Editor/  \n│   ├── ComfyBridgeMenu.cs  \n│   ├── ComfyNodeConfigDrawer.cs  \n│   └── ComfyWorkflowExecutorEditor.cs  \n├── Runtime/  \n│   ├── ComfyDataModels.cs       \\\u003c-- Data definitions  \n│   ├── ComfyManager.cs          \\\u003c-- Connection handler  \n│   ├── ComfyNodes.cs            \\\u003c-- Node configuration logic  \n│   └── ComfyWorkflowExecutor.cs \\\u003c-- Main engine  \n├── Samples\\~/                    \\\u003c-- Examples (Hidden from auto-import)  \n│   ├── Scenes/  \n│   ├── Scripts/  \n│   └── Textures/\n```\n\n## **Quick Start**\n\n### **1\\. One-Click Setup**\n\nIn the Unity Toolbar, go to **Tools \\\u003e ComfyUI Bridge \\\u003e Quick Setup**.\n\nThis will automatically create a **ComfyBridge** object in your scene with the necessary ComfyManager and ComfyWorkflowExecutor components attached.\n\n### **2\\. Configure the Executor**\n\nSelect the **ComfyBridge** object in your scene.\n\n* **Workflow File Name:** Enter the name of your JSON file (e.g., text2img\\_api.json).  \n* **Expected Output:** Select the type (Image, Audio, Object3D, etc.).  \n* **Output Target:** Drag your RawImage, AudioSource, or Spawn Transform into the exposed slot.\n\n### **3\\. Configure Inputs**\n\nIn the ComfyWorkflowExecutor inspector, look for **Node Configuration**.\n\n1. Click **\\+** to add an input.  \n2. **Type:** Select the type (e.g., TextPrompt, KSampler, ImageInput).  \n3. **ID:** Enter the Node ID from your ComfyUI JSON file (e.g., \"6\" for prompts, \"3\" for sampler).  \n4. Fill in the values (Text, Seed, Input Texture, etc.).\n\n*Tip: Click the small \"Refresh\" icon next to the ID field to auto-load default values from your JSON file.*\n\n### **4\\. Run It via Code**\n\nYou can trigger generation from any script using the ComfyUIBridge namespace.\n\n```\nusing UnityEngine;  \nusing ComfyUIBridge; // Import the namespace\n\npublic class ExampleGenerator : MonoBehaviour  \n{  \n    public ComfyWorkflowExecutor executor;\n\n    public void GenerateSimple()  \n    {  \n        // Simple Run (Linked to Unity Button)  \n        executor.Execute();  \n    }\n\n    public void GenerateQueue()  \n    {  \n        // Modify values and Queue (Fire and Forget)  \n        // This is safe to call multiple times rapidly.  \n        executor.QueueGeneration(() \\=\\\u003e {  \n            var promptNode \\= executor.inputNodes.Find(n \\=\\\u003e n.nodeID \\== \"6\");  \n            promptNode.textValue \\= \"A cyberpunk city, neon lights\";  \n              \n            var samplerNode \\= executor.inputNodes.Find(n \\=\\\u003e n.nodeID \\== \"3\");  \n            samplerNode.randomizeSeed \\= true;  \n        });  \n    }  \n}\n```\n\n## **Output Specifics**\n\n* **Audio:** Supports WAV, MP3, OGG, AIFF. If a FLAC file is received, it will be downloaded to Application.persistentDataPath (as Unity cannot play FLAC natively), and a path will be logged to the console.  \n* **3D Models:** Requires the glTFast package. Models are instantiated at the Result 3D Spawn Point transform.  \n* **RenderTextures:** Input RenderTextures are automatically converted to temporary Texture2D assets and uploaded to the server before generation.\n\n## **Troubleshooting**\n\n* **400 Bad Request:** Check your Console. The Manager prints the specific server error. This often happens if you send a Float to an Int field (like Steps).  \n* **Image not changing:** Ensure your ImageInput Node ID matches the \"Load Image\" node in your JSON.  \n* **Audio not playing:** Unity **does not support FLAC natively**. In your ComfyUI workflow, please ensure your \"Save Audio\" node is set to output **WAV**, **MP3**, or **OGG**. If FLAC is used, the file will be downloaded to disk but will not play automatically.  \n* **Namespace Errors:** Ensure your scripts include using ComfyUIBridge;.\n\n## **License**\n\n\\[MIT License\\]","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famin-hp%2Funity-comfyui-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famin-hp%2Funity-comfyui-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famin-hp%2Funity-comfyui-bridge/lists"}