Modules

Optional modules that let your AI listen, speak, generate images, or execute functions.

These modules act as optional extensions that can be plugged into AI components like Chatbot, Chatbot (Assistants API), and other higher-level interfaces.

They allow your AI to listen, speak, generate images, or execute user-defined functions in response to AI requests.


1. Speech to Text

Enables voice input functionality using microphone capture.

What it does

  • Records audio using the microphone.

  • Converts speech to text asynchronously.

  • Returns a Transcript object.

Typical usage Call StartRecording(), speak, then call StopRecording() to get the Transcript.

stt.StartRecording();
// user speaks
Transcript transcript = await stt.StopRecording();

Text to Speech

Provides voice output via TTS generation.

What it does

  • Converts a string response into GeneratedAudio (AudioClip).

  • Can play automatically if AudioSource is attached.

Use with Chatbot or Chatbot (Assistants API) to read responses aloud.

GeneratedAudio audio = await tts.GenerateSpeechAsync("Hello!");
audioSource.clip = audio;
audioSource.Play();

Voice Changer

Applies optional pitch and speed post-processing to audio output.

What it does

  • Alters pitch and speed for stylistic or character-based transformation.

  • Simulates different speaker characteristics.

Optional Enhances immersion but is not required.


Image Generator

Generates images from natural language prompts.

What it does

  • Supports models like DALL·E (OpenAI) and Imagen (Google).

  • Customizable: resolution, style, aspect ratio, quality.

Output Returns a GeneratedImage containing a Texture2D.

var image = await imageGenerator.GenerateImageAsync("A futuristic city at night");

Function Manager

Registers C# methods as callable functions through Function Calling.

What it does

  • Makes Unity methods callable by the AI.

  • Auto-generates parameter schema and metadata.

How to Use

  1. Add FunctionManager to a GameObject.

  2. Assign a script with public void methods.

  3. Select a method in the Inspector.

  4. Optionally describe parameters for the AI.

public class GameFunctions : MonoBehaviour
{
    public void HealPlayer(int amount, string reason)
    {
        Debug.Log($"Healing player by {amount} because {reason}");
    }
}

Last updated