Skip to content

berkelmali/Unity-AI-Dialogue-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎭 AI-Powered NPC Dialogue Tool

Unity C# License

A professional Unity Editor Tool designed to streamline the creation of dynamic NPC dialogues. This tool simulates AI-driven text generation using asynchronous calls (async/await) to prevent editor freezing and utilizes JSON Serialization to save generated data for in-game implementation.

📸 Preview

image

(This tool allows developers to generate and save dialogues without leaving the Unity Editor)

🌟 Key Features

  • Custom Editor Window: Built entirely using Unity's EditorWindow API for a native look and feel.
  • Asynchronous Execution: Uses C# Task and async/await patterns to handle generation delays without locking the main thread.
  • Diverse Personas: Includes a mock database with 6 distinct characters (e.g., Wretched Beggar, Goblin Scout, Mysterious Wizard) and over 120 unique lines.
  • JSON Save System: Successfully generated dialogues can be serialized and exported to .json files with a single click.
  • UX/UI Design: Features conditional buttons, loading states, and user feedback loops.

🛠 Technical Implementation

1. Editor Scripting & GUI

The tool extends EditorWindow to create a custom interface within Unity.

[MenuItem("My AI Tools/Dialogue Generator")]
public static void ShowWindow()
{
    GetWindow<DialogueWindow>("AI Dialogue Tool");
}

2. Async/Await Pattern (No Coroutines)

Instead of legacy Coroutines, modern Task based asynchronous programming is used to simulate API latency.

async void GenerateMockDialogue()
{
    isGenerating = true;
    await Task.Delay(1000); // Non-blocking delay
    // ... logic ...
    isGenerating = false;
    Repaint();
}

3. Data Serialization

The tool converts runtime objects into persistent data using JsonUtility.

{
    "characterName": "Wretched Beggar",
    "dialogueText": "[Wretched Beggar]: Alms for the poor...",
    "dateCreated": "12/19/2025"
}

⚖️ License & Rights

⚠️ PROPRIETARY LICENSE - ALL RIGHTS RESERVED

This software and its associated documentation are the exclusive property of Berk Elmalı. No Commercial Use: You may not use this source code for commercial purposes without explicit written permission from the author. No Modification: You may not modify, distribute, or create derivative works based on this project. No Distribution: You may not host this code on any public repository or server without authorization. For permission requests, please contact the author directly.

🚀 How to Install

Clone this repository.

Open the project in Unity 6 (6000.x) or later. Navigate to the top menu: My AI Tools -> Dialogue Generator.

👨‍💻 Author Berk Elmalı

Developed as a demonstration of Tool Programming, Editor Scripting, and System Architecture in Unity.

About

A custom Unity Editor tool for generating AI-powered NPC dialogues with async execution and JSON serialization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages