top of page

Online - Setup Tutorial

Purpose: This guide shows how to connect the online MetaMix3D NPC service to your Unity scene and test live chat.

Before you start

·       The MetaMix3D package is already imported into Unity.

·       The sample scene or your own scene is open.

·       An online NPC has already been created in the MetaMix3D web app.

·       You have your API key from the MetaMix3D SaaS dashboard.

 

Setup Steps

Step 1: Open the MetaMix3D web app

Go to your MetaMix3D SaaS app.

 

https://app.metamix3d.com/

 

 

Step 2: Create or open an NPC

Inside the web app, create a new NPC or open an existing NPC.


Step 3: Copy the NPC ID

Find the NPC ID in the web app and copy it.

This ID tells Unity which online NPC to talk to.

 

Step 4: Copy your API key

Open the API Key Management page in the web app and copy your API key.

Keep this key private.

sk_user_xxxxxxxxxxxxxxxxx

 

Step 5: Open Unity settings

In Unity, go to the package Settings folder and select the settings asset named NPC_AI_DefaultSettings.

 

Step 6: Switch to Online mode

In the Inspector, set Response Mode to Online.

 

Step 7: Enter the API Base URL

In NPC_AI_DefaultSettings, set Api Base Url to the backend endpoint below.


https://yjxwdhebrnwasqvhnwzu.supabase.co/functions/v1

i.e. Do not use the web app homepage URL.

 

Step 8: Enter your API key

Paste your SaaS API key into the Api Key field in the same settings asset.

 

Step 9: Select your NPC in Unity

In the scene, click the NPC GameObject you want to connect, such as GuardNPC, ExplorerNPC, or TerrainExpertNPC.

 

Step 10: Assign the shared settings asset

In the NPC Inspector, find the AINPCChat component and assign Settings = NPC_AI_DefaultSettings.

 

Step 11: Paste the Online NPC ID

In the same AINPCChat component, paste the real NPC ID from the SaaS app into Online Npc Id.

Do not use fake local IDs like guard_001 unless that exact ID exists in your backend.

 

Step 12: Press Play

Click Play in Unity.

 

Step 13: Walk to the NPC

Move the player close to the NPC so the chat window opens.

 

Step 14: Send a message

Type a simple message such as hi and send it.

If everything is set correctly, the NPC should return a live online response from the SaaS backend.

 

Expected Result

·       The NPC chat window opens normally.

·       Your message is sent from Unity.

·       The reply comes back from the online backend.

·       The NPC responds using the online persona linked to the NPC ID.

 

Common Issues

  • Error: 404 NPC persona not found: Cause: wrong Online Npc Id. Fix: copy the exact NPC ID from the SaaS app again and paste it into the Unity NPC Inspector.

  • Error: API key missing: Cause: no API key entered in NPC_AI_DefaultSettings. Fix: paste your real SaaS API key into the settings asset.

  • Error: 404 Not Found: Cause: wrong API Base URL. Fix: use the backend endpoint shown earlier, not the web app homepage.

  • No response in chat: Check that Response Mode is Online, the API key is correct, the NPC ID is correct, and internet connection is available.

 

Summary

1.         Open the MetaMix3D web app.

2.         Copy the NPC ID and API key.

3.         Set Unity Response Mode to Online.

4.         Add the API Base URL and API key.

5.         Assign the settings asset to the NPC.

6.         Paste the real NPC ID into the NPC Inspector.

7.         Press Play and test live chat.

dddd.png

Online Live AI Demo

bottom of page