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
  • Accessing the Unity Component Generator
  • Using the Unity Component Generator
  • Best Practices
  1. Pro Features
  2. Generation Menu
  3. Code Generators

Unity Component Generator

PreviousC# Script GeneratorNextEditor Chat

The Unity Component Generator is an innovative tool that simplifies the process of creating MonoBehaviour scripts tailored for specific components within Unity. Leveraging OpenAI's advanced models, this tool generates scripts based on descriptive prompts provided by developers, directly integrating them as components on GameObjects in the Unity Editor.

Accessing the Unity Component Generator

The Unity Component Generator integrates seamlessly into the Unity Editor, enhancing the development workflow with AI-powered script generation:

  1. Select a GameObject in your scene that you wish to add a new component to.

  2. In the Inspector window, locate the 'Generate Component' button situated directly under the traditional 'Add Component' button.

Using the Unity Component Generator

Step 1: Describing the Desired Component

After clicking 'Generate Component', a window will appear prompting you to describe the functionality of the component you want to generate. Your description should be as detailed as possible to guide the AI in generating a script that matches your requirements. For example:

  • "Create a script that makes an object rotate continuously."

  • "Generate a health system component with methods for taking damage and healing."

Step 2: Reviewing Generated Code

Once you've submitted your prompt, the tool processes your request and presents the generated script code for review. This is where you can assess the code's suitability for your project and ensure it aligns with your intended functionality.

Step 3: Confirming and Attaching the Script

  • Confirmation: If the generated script meets your expectations, confirm the generation. This will automatically create a new C# script file in your project and attach it as a component to the selected GameObject.

  • Revision: If the script requires adjustments or does not meet your needs, you can modify the prompt and regenerate the script.

Best Practices

  • Clear and Concise Prompts: The accuracy of the generated script heavily depends on the clarity and detail of your prompts. Clearly state the intended functionality and any specific requirements.

  • Iterative Generation: Don't hesitate to regenerate the script with adjusted prompts for better outcomes.

  • Script Review: Always review the generated script thoroughly. Even though the script is generated based on your prompt, it may require minor tweaks or optimizations to perfectly fit your project's architecture and coding standards.