AI DevKit
Glitch9 Inc.Glitch9 DocsDiscordIssues
  • Introduction
    • AI DevKit 3.0
    • Update Logs
    • Troubleshooting
      • ❗Issues After Updating AIDevKit?
      • ❗The type or namespace name 'Newtonsoft' could not be found
      • ❗Build Error: The name 'UnityMenu' does not exist in the current context
      • ❗Model 'modelName' not found
      • ❗The model `model name` does not exist or you do not have access to it
      • ❗The type or namespace name 'AndroidJavaObject' could not be found
      • ❗The type or namaspace name 'Plastic' does not exist
      • ❗Build Error: The name 'Asset Database' does not exist in the current context
      • ❗'ModelData.Create(Provider, string, UnixTime?, string)': not all code paths return a value
      • ⚠️ Timeout Issues
      • ⚠️ Receiving a “HTTP/1.1 400 Bad Request” Error?
    • FAQ
      • My OpenAI API free trial has ended or is inactive.
  • Quick Start
    • Get API Keys
      • OpenAI API Key Guide
      • Google API Key Guide
      • ElevenLabs API Key Guide
    • Text Generation
    • C# Object Generation
    • Image Generation
    • Sound Effect Generation
    • Text to Speech (TTS)
    • Speech to Text (STT)
    • Voice Changer
    • Audio Isolation
  • Pro Features
    • Generation Menu
      • Code Generators
        • C# Script Generator
        • Unity Component Generator
    • Editor Chat
    • Editor Vision (TTI, ITI)
    • Editor Speech (TTS)
    • Management Tools
      • Prompt History Viewer
      • AI Model Manager
      • TTS Voice Manager
      • OpenAI File Manager
      • OpenAI Assistant Manager
      • ElevenLabs Voice Library
  • Assistants API (OpenAI)
    • How it works
    • Creating custom functions
    • Creating assistants API
  • Advanced API Supports
    • OpenAI API
      • 💬Chat completions
      • 🖼️Image operations
      • 🗣️Text to speech
      • 🎙️Speech to text
        • Recording real-time in Unity
      • 💾Files
      • 🔎Embeddings
      • 🛡️Moderations
      • ⚙️Fine-tuning
    • Google API
      • 📝System instructions
      • 💬Text generation
      • ⚙️Fine-tuning
      • ▶️Fucntion calling
      • 🔎Embeddings
      • 🛡️Safety
      • 💻Code execution
    • ElevenLabs API
  • Legacy Documents
    • AI DevKit 1.0 - 2.0
      • AI DevKit 2.0
      • AI DevKit 1.0
      • Preperation
      • Event Handlers
      • Scriptable Toolkits
        • Chat Streamer
        • Image Generator
        • Voice Transcriber
        • Voice Generator
      • Editor Tools
Powered by GitBook
On this page
  1. Quick Start

Image Generation

Image generation lets you create stunning visuals from text prompts using models like DALL·E, Gemini Imagen, and others.

There are three primary modes available:

  • 🖌️ Image Creation – Generate a new image from a text description

  • ✂️ Image Edit – Modify an existing image using a prompt

  • 🎨 Image Variation – Create visual remixes or alternatives of an image


✅ 1. Image Creation (from Text)

Texture2D result = await "A cat surfing a wave"
    .GENImage()
    .SetModel(ImageModel.DallE3)
    .ExecuteAsync();

🎨 The image is downloaded and converted into a Unity Texture2D. You can also save it directly using .SaveToDisk() or convert it to PNG.


✅ 2. Image Edit (prompt + image)

Texture2D result = await myTexture
    .GENImageEdit("Add a crown on the cat's head")
    .SetModel(ImageModel.DallE2)
    .ExecuteAsync()
    .AsTexture2D();

✂️ The given image is used as a base, and the model performs localized edits.


✅ 3. Image Variation (image only)

Texture2D result = await myTexture
    .GENImageVariation()
    .SetModel(ImageModel.DallE2)
    .ExecuteAsync();

🎨 A new image is generated based on the style and structure of the original.


📦 Example Output

  • Prompt: "A futuristic city with flying cars"

  • Output: A 1024×1024 image showing a neon-lit cyberpunk skyline


🧩 Advanced Configuration (Per Provider)

Fluent API extensions allow you to customize behavior depending on the selected model.


🔵 OpenAI (DALL·E 2 & 3)

Texture2D result = await "A cyberpunk city at night"
    .GENImage()
    .SetModel(ImageModel.DallE3)
    .SetSize(ImageSize._1024x1024)
    .SetQuality(ImageQuality.HD)
    .SetStyle(ImageStyle.Vivid)
    .ExecuteAsync();
Method
Description

SetSize(ImageSize)

Set image resolution (_256x256, _512x512, _1024x1024)

SetQuality(ImageQuality)

Choose quality (Standard, HD)

SetStyle(ImageStyle)

Define visual tone (Natural, Vivid)

SetMask(Texture2D)

Apply inpainting mask (for edits only)


🟢 Google (Gemini / Imagen)

Texture2D result = await "An astronaut riding a horse"
    .GENImage()
    .SetModel(GeminiModel.Imagen2)
    .SetAspectRatio(AspectRatio.Square)
    .SetPersonGeneration(PersonGeneration.Unspecified)
    .ExecuteAsync();
Method
Description

SetAspectRatio(...)

Choose image layout: Square, Portrait, Landscape

SetPersonGeneration(...)

Control generation of human figures (e.g., allow, deny, unspecified)


🧠 Tips

  • DALL·E 3 only supports generation (not editing/variation) through the OpenAI API.

  • All outputs are automatically saved to a temporary location unless SetOutputPath() is used.

  • Use .AsTexture2D(), .AsPNG(), or .SaveToDisk() depending on your workflow.

  • Not all models support all features. Use .SetModel(...) early and tailor the configuration accordingly.

PreviousC# Object GenerationNextSound Effect Generation

Last updated 18 days ago