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

C# Script Generator

PreviousCode GeneratorsNextUnity Component Generator

C# Script Generator streamlines the creation of C# scripts for Unity developers. By leveraging OpenAI's GPT models, it generates scripts based on natural language prompts, facilitating rapid development of functionalities that would typically require more time to code manually.

Accessing the C# Script Generator

To access the C# Script Generator:

  1. Navigate to the Project window within the Unity Editor.

  2. Right-click on the desired directory where you wish to generate the new script.

  3. Find the Generate C# Script with GPT button located directly under the Create button at the top of the context menu.

Using the C# Script Generator

Step 1: Inputting Your Prompt

After opening the C# Script Generator window, you'll be prompted to describe the script you want to generate. This description should be as detailed as possible to ensure the generated script meets your needs. Examples of prompts include:

  • "Implement a generic singleton pattern for game managers."

  • "Create a player movement script using Rigidbody for a 3D platformer."

Step 2: Configuring Script Options

  • Namespace: Optionally, specify the namespace for your script. This helps in organizing your code and preventing naming conflicts.

  • Model Selection: Choose between available GPT models for script generation. Different models may offer varying levels of creativity and accuracy.

Step 3: Generating the Script

Once you have input your prompt and configured the script options, click the "Generate" button. The tool will communicate with OpenAI's API and generate a C# script based on your description.

Step 4: Reviewing and Confirming

  • Review: The generated script will be displayed for your review. You can read through the code to ensure it aligns with your project requirements.

  • Confirmation: If the script meets your expectations, confirm the generation to add the script to your project. If not, you can modify the prompt and regenerate the script.

Best Practices

  • Detailed Prompts: Provide detailed and specific prompts to improve the relevance and accuracy of the generated scripts.

  • Prompt Examples: Use the "Show me some examples" feature for inspiration or to better understand how to formulate effective prompts.

  • Review Generated Code: Always review the generated code for accuracy, efficiency, and adherence to best practices before integrating it into your project.