Text to Image

Generate images from text descriptions using .GENImage() or .TextToImage().

Basic Usage

Texture2D image = await "A serene mountain landscape at sunset"
    .GENImage()
    .ExecuteAsync();

Input Types

String Input

Texture2D image = await "Cyberpunk city at night"
    .GENImage()
    .ExecuteAsync();

Prompt Input

var prompt = new Prompt("A {adjective} {subject} in {style} style");
Texture2D image = await prompt
    .GENImage()
    .ExecuteAsync();

Alias Method

Configuration

Model Selection

Image Size

Available sizes:

  • ImageSize._256x256 (DALL-E 2 only)

  • ImageSize._512x512 (DALL-E 2 only)

  • ImageSize._1024x1024 (All models)

  • ImageSize._1792x1024 (DALL-E 3 only)

  • ImageSize._1024x1792 (DALL-E 3 only)

Quality

Style

Number of Images

Complete Example

Unity Integration Examples

Example 1: UI Sprite Generation

Example 2: Material Texture

Example 3: Skybox Generation

Example 4: Batch Generation

Example 5: Save to Disk

Prompt Engineering Tips

✅ Good Prompts

❌ Bad Prompts

Provider Support

OpenAI DALL-E

Google Imagen

Error Handling

Best Practices

✅ Do

  • Be specific with prompts

  • Specify art style and mood

  • Use appropriate size for your use case

  • Consider quality vs cost tradeoff

  • Cache generated images

  • Handle errors gracefully

❌ Don't

  • Use vague prompts

  • Generate unnecessarily large images

  • Forget to dispose unused textures

  • Ignore memory management

  • Generate images in tight loops

Performance Considerations

Next Steps

Last updated