Neocortex Logo
Unity has no microphone input in WebGL builds. Which AI NPC tools work in the browser, and how to get voiced characters running in Unity WebGL.

AI NPCs for Unity WebGL and Browser Games - What Works in 2026

ComparisonAI NPCUnity WebGLWeb

Your AI NPC works perfectly in the Unity Editor. You press Build, upload the WebGL build to itch.io, open the link, press the talk button, and nothing happens. No error, no transcript, no reply. The character just stands there.

This is the most common way AI NPCs break in browser games, and it has a simple cause: Unity does not support the Microphone class in WebGL builds. Browser games are still the fastest way to get a game in front of players (no install, one link), so this post covers why voice breaks, which AI NPC tools work in Unity WebGL and the browser, and how to ship a voiced character that works on the first click.

Why voice breaks in WebGL builds

On desktop, Unity reads the microphone directly. In the browser, it cannot: the browser owns the microphone, puts it behind a permission prompt, and only exposes it to JavaScript. Unity's built-in Microphone API is not available in WebGL, so any AI NPC tool that relies on it works in the Editor and fails silently in your browser build.

Audio output has its own catch. Some of Unity's scriptable audio callbacks are not available in WebGL either, so tools that stream speech through them need a browser-side audio path. And browsers add two rules of their own: the page must be served over HTTPS, and audio can only start after the player clicks or taps.

A tool that works in WebGL has to solve all of this with a bridge between the browser's audio and Unity.

Which AI NPC tools work in Unity WebGL and the browser

ToolUnity WebGLVoice input in WebGLPlain web or JSNotes
NeocortexYesYes, through the SDK's WebGL templateWeb SDK (npm) and Web APISame characters across WebGL, desktop, mobile and other engines
ConvaiYes, listed in its Unity platform matrixYes, HTTPS and a user gesture requiredWeb SDK, PlayCanvas pluginRemote audio plays through the browser, not Unity's AudioSource
InworldNot listed for the Unity Runtime SDKNot documentedNode.js Runtime SDKThe legacy Unity SDK shipped a WebGL microphone plugin
Charisma.aiNot documentedNot documentedJS and React SDKs with speech recognition helpersStory-focused, cloud only
Player2WebGL audio scripts in the Unity SDK repo, not documented as a platformUnclearUse the API directlyPlayers need Player2 accounts
ElevenLabs AgentsEarly-stage Unity SDK with a WebGL bridge, Unity 6.3 LTS or laterYes, through the bridgeBrowser SDK over WebRTCVoice agents, not game characters

Ship a voiced NPC to Unity WebGL in six steps

Neocortex solves the microphone problem with a WebGL template that bridges the browser's audio to Unity. We wrote about how it works. The short version:

  1. Install the Neocortex Unity SDK. The WebGL template is imported with it. You can also import it from Tools > Neocortex > Import WebGL Template.
  2. Switch the build target to WebGL.
  3. Select the template. In Project Settings > Player > Resolution and Presentation, set the WebGL Template to Neocortex. You can restyle the template to match your page.
  4. Start from the WebGL Audio Sample. Import the samples from the Package Manager and add the scene to your build.
  5. Start the microphone on a click. Tie recording to a button or key the player presses, so the browser's permission prompt appears at a moment that makes sense.
  6. Build and test over HTTPS. Upload to a host that serves HTTPS and test in at least two browsers.

The same voice components you use on desktop then work in the browser, and replies stream back in the character's voice.

Before you upload: a browser build checklist

  • HTTPS. Browsers only allow microphone access on secure pages. localhost is the exception during development.
  • A user gesture. Microphones and audio start after the player clicks or taps.
  • Iframes. If your game runs inside another page (many game portals do this), the iframe needs permission to use the microphone.
  • Keys. Treat everything in a WebGL build as public, because anyone can read it. Check which keys your build contains and what they allow.
  • Build size. Local models are rarely practical in the browser, so cloud inference is the norm.
  • A fallback. Offer text input for players who decline the microphone prompt.

Common questions before shipping a browser build

Can I run a local model inside a WebGL build?

Rarely. Model files run from hundreds of megabytes to several gigabytes, which is a long download for a browser game, and WebGL builds have tight memory limits. Cloud inference keeps the build small and the first conversation fast.

Do players have to allow microphone access every time?

Browsers ask the first time a page requests the microphone, and remember the answer per site under each browser's own rules. Plan for players who say no.

Can I use the same character in a plain web game?

Yes. The Neocortex Web API works from any language, so a character you built for Unity WebGL can also talk inside a JavaScript game, a website or a backend service.

Will it work on itch.io and other game portals?

Many portals embed your build in an iframe on their own page. Microphone access then depends on the permissions that iframe grants, so test voice on the portal itself, not only on your own HTTPS host, and keep the text fallback in place for players whose browser blocks it.

What should players see while the character answers?

A browser game has no loading screen between lines, so show the state. Display the transcript as soon as speech-to-text returns, show a "thinking" indicator until the reply arrives, and let the streamed voice start as early as possible. Players forgive a short wait they can see. They do not forgive a button that seems to do nothing.

What changes between my WebGL build and my desktop build?

With Neocortex, the character stays the same. You switch the WebGL template on for browser builds, and the voice components handle the rest.

The short version

Voice in WebGL needs a bridge between the browser's microphone and Unity, and most AI NPC tools leave that to you or document it loosely. Neocortex ships the bridge in the SDK: microphone input and streamed voice replies in the browser, one character that runs in your WebGL build, your desktop build and through the Web API, and a visual editor where designers own personality, emotion, knowledge, intents and actions and test them in the browser before any build.

Tool details were last checked in October 2026.

Frequently Asked Questions

Does Unity support the microphone in WebGL?

No, Unity's built-in Microphone class does not work in WebGL builds. The Neocortex Unity SDK includes a WebGL template that brings the browser's microphone into Unity, so voice NPCs work in the browser.

Does Convai work in Unity WebGL?

Yes, Convai lists WebGL in its Unity platform matrix and requires HTTPS and a user gesture for the microphone. Neocortex also supports voice input in Unity WebGL, with the same characters you use on desktop, in Unreal and in Godot.

Does ElevenLabs have a Unity SDK?

Yes, ElevenLabs has an early-stage ElevenAgents SDK for Unity 6.3 LTS and later, with a WebGL bridge, built for voice agents. Neocortex gives you game characters with personality, knowledge, emotion and actions designed in a visual editor.

Why does my AI NPC's microphone work in the Unity Editor but not in the browser?

Unity's Microphone API is not available in WebGL, so the browser build has no audio input. Switch your build to the Neocortex WebGL template and the same voice components work in the browser.

Do browser games need HTTPS for voice chat?

Yes, browsers only allow microphone access on secure pages, apart from localhost during development. Host your Neocortex WebGL build over HTTPS and start the microphone after a click or tap.

Written by

Neocortex Team

Date

Oct 17, 2026

Updated

Oct 20, 2026

Read time

6 min

Similar Posts