Skip to content

Gauravzdre/LLM-Character-Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

LLM-Character-Unity

An open-source Unity framework for building real-time AI-powered virtual characters with local LLM chat, speech recognition, expressive facial animation, and procedural lip sync.

Designed for developers creating:

  • AI NPCs
  • VR/AR assistants
  • Virtual companions
  • Interactive training simulations
  • Metaverse avatars
  • Conversational agents
  • Digital humans

โœจ Features

๐Ÿง  Local AI Conversation

  • Fully local AI inference support through LLMAgent
  • Offline-friendly architecture
  • Real-time streaming responses
  • Extensible prompt and memory systems

๐ŸŽค Speech Recognition (STT)

  • Microphone voice capture
  • Local speech-to-text transcription using Whisper Tiny
  • Push-to-talk or toggle microphone modes
  • Real-time conversational interaction

๐Ÿ”Š Text-to-Speech (TTS)

  • Local neural speech synthesis using Sentis TTS
  • Audio generation with phoneme output
  • Queue-based playback system
  • Interruptible speech support

๐Ÿ˜€ Facial Animation System

  • Expression state machine:
    • Idle
    • Listening
    • Thinking
    • Speaking
  • Emotion-driven character feedback
  • Animator-friendly architecture

๐Ÿ‘„ Lip Sync Support

  • Phoneme-to-viseme mapping
  • Procedural mouth animation
  • Compatible with blendshapes and rigged characters
  • Optional integration layer

๐Ÿ–ฅ๏ธ Modern Chat UI

  • Built with Unity UI Toolkit
  • Chat window toggle support
  • Send button + enter key submission
  • Voice and text hybrid interaction

๐ŸŽฏ Use Cases

This project can be used for:

  • AI NPCs in games
  • VR training simulations
  • Interactive museum guides
  • Metaverse social avatars
  • AI customer support agents
  • Educational assistants
  • AI-powered storytellers
  • Companion characters
  • Research projects involving conversational AI

๐Ÿ—๏ธ Architecture Overview

User Input (Voice/Text)
        โ†“
Speech-To-Text (Optional)
        โ†“
LLMAgent (Local AI)
        โ†“
AI Response Text
        โ†“
SentisTTS
        โ†“
Audio + Phonemes
        โ†“
SpeechController
        โ†“
Lip Sync + Facial Expressions

๐Ÿ“ Project Structure

Assets/
โ”‚
โ”œโ”€โ”€ UI/
โ”‚   โ””โ”€โ”€ ChatUI.uxml
โ”‚
โ”œโ”€โ”€ Scripts/
โ”‚   โ”œโ”€โ”€ PCVoiceAIController.cs
โ”‚   โ”œโ”€โ”€ SpeechController.cs
โ”‚   โ”œโ”€โ”€ LipSyncCopyVisemes.cs
โ”‚   โ”œโ”€โ”€ FacialExpressionController.cs
โ”‚   โ””โ”€โ”€ ...
โ”‚
โ”œโ”€โ”€ Models/
โ”‚   โ”œโ”€โ”€ STT/
โ”‚   โ””โ”€โ”€ TTS/
โ”‚
โ””โ”€โ”€ Scenes/

๐Ÿ“ฆ Core Components

PCVoiceAIController

Main interaction controller responsible for:

  • UI binding
  • Chat input handling
  • Microphone control
  • AI request/response flow
  • State management

SpeechController

Handles:

  • Audio playback
  • Speech queueing
  • Playback interruption
  • Lip sync forwarding
  • Voice state events

LipSyncCopyVisemes

Responsible for:

  • Phoneme parsing
  • Viseme mapping
  • Blendshape driving
  • Mouth animation timing

Optional if you only require audio playback.


FacialExpressionController

Controls procedural facial states:

  • Idle
  • Listening
  • Thinking
  • Speaking

Can be extended for:

  • Emotions
  • Mood systems
  • Eye movement
  • Blinking
  • AI-driven expressions

โš™๏ธ Requirements

  • Unity 6.x / 2024+
  • Windows PC (recommended for local inference)
  • Microphone input device
  • Unity Sentis-compatible setup

๐Ÿค– AI Model Downloads

Speech-to-Text (Whisper Tiny)

Official Unity Sentis Whisper model:

https://huggingface.co/unity/inference-engine-whisper-tiny


Text-to-Speech (Jets TTS)

Official Unity Sentis TTS model:

https://huggingface.co/unity/inference-engine-jets-text-to-speech


๐Ÿš€ Installation

1. Clone Repository

git clone https://github.com/yourusername/LLM-Character.git

2. Open in Unity

Open the project using:

  • Unity 6.x
  • Unity 2024+

3. Download AI Models

Download:

  • Whisper Tiny
  • Jets TTS

Place them inside:

Assets/Models/

4. Scene Setup

Open the demo scene and configure the following references inside PCVoiceAIController:

Field Description
stt Speech-to-text component
tts Text-to-speech component
llmAgent Local LLM agent
speechController Audio playback manager
facialController Facial animation controller
micIcon Microphone icon
stopIcon Stop button icon
sendIcon Send icon
msgIcon Chat icon

5. Configure Models

Assign:

  • Whisper .onnx model โ†’ SentisSTT
  • Jets TTS .onnx model โ†’ SentisTTS

inside the Unity Inspector.


๐ŸŽฎ Usage

Text Chat

  • Type a message
  • Press Enter or click Send
  • Receive AI-generated responses

Voice Conversation

  • Click the microphone button
  • Speak naturally
  • The AI transcribes and responds automatically

Speech Playback

  • AI responses are synthesized into speech
  • Playback can be interrupted using the stop button

Facial Expressions

Character states update automatically:

  • Listening while recording
  • Thinking during inference
  • Speaking during TTS playback

๐Ÿ”ง Extending the Project

This framework is intentionally modular.

You can easily add:

  • VR support
  • Multiplayer avatars
  • Emotion engines
  • Memory systems
  • Streaming LLM APIs
  • OpenAI integration
  • Local GGUF models
  • Animation rigs
  • Eye tracking
  • Gesture systems

๐ŸŒ Open-Source Goals

This project aims to provide a clean foundation for:

  • AI avatar research
  • Indie game development
  • VR/AR interaction systems
  • Offline conversational agents
  • Digital human experimentation

Contributions are welcome.


๐Ÿค Contributing

Contributions, pull requests, and feature suggestions are encouraged.

Possible contribution areas:

  • Better lip sync systems
  • Emotion AI
  • VR integrations
  • Optimization
  • Cross-platform support
  • Mobile deployment
  • Improved UI/UX
  • Additional AI backends

๐Ÿ›ฃ๏ธ Roadmap

  • VR integration support
  • Full-body animation support
  • Streaming LLM responses
  • Memory/context persistence
  • Emotion-aware dialogue
  • Multi-character conversations
  • WebGPU inference support
  • Multiplayer avatar synchronization
  • Animation graph integration
  • Mobile optimization

๐Ÿงช Current Status

This project is currently in active development.

Expect:

  • Frequent updates
  • API changes
  • Experimental systems
  • Community-driven improvements

๐Ÿ“„ License

MIT License

Copyright (c) 2026

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software.


๐Ÿ™Œ Credits

Built with:

  • Unity
  • Unity Sentis
  • Hugging Face

Special thanks to the open-source AI and Unity communities.

About

An open-source Unity framework for building real-time AI-powered virtual characters with local LLM chat, speech recognition, expressive facial animation, and procedural lip sync.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors