How to use the XR8WebAR Unity addon for 8th Wall AR experiences in Unity WebGL builds
This addon provides 8th Wall AR tracking for Unity WebGL builds. It bridges C# scripts to the 8th Wall JS engine via .jslib files and xr8-bridge.js.
C# Scripts ←→ .jslib (DllImport) ←→ xr8-bridge.js ←→ 8th Wall Engine
Recommended: Use XR8 WebAR > Quick Setup Wizard in the menu bar.
The wizard has 3 tabs:
Use XR8 WebAR > Scene Templates for pre-configured scenes:
| Menu Item | Purpose |
|---|---|
XR8 WebAR > Quick Setup Wizard | One-click scene setup, validation, and build |
XR8 WebAR > Scene Templates | 8 pre-built AR scene types (New/Add To Scene toggle available) |
XR8 WebAR > Image → Video Quick Setup | Instantly creates an Image Target with an auto-scaled, matching Video Overlay |
XR8 WebAR > Generate All Scene Templates | Batch create all templates into new scenes |
XR8 WebAR > Import Gaussian Splat | Drag-drop .ply/.splat → ready prefab |
XR8 WebAR > Image Trackability Analyzer | Score images 0-100 for tracking quality |
XR8 WebAR > Build WebGL | Quick build shortcut |
| Script | Purpose |
|---|---|
XR8Manager | Unified controller — enable tracking modes, desktop preview |
XR8Camera | Camera feed background rendering, URP support |
XR8ImageTracker | Image target tracking with anchor-based workflow + quality presets |
XR8FaceTracker | Face tracking with expressions, landmarks, 6 attachment points |
XR8WorldTracker | SLAM world tracking — 6DOF, 3DOF, Orbit modes. JS origin place/reset, compass, angle smoothing |
XR8CombinedTracker | Image + World combined (gallery/museum mode) |
XR8PlacementIndicator | Visual reticle for tap-to-place placement workflow |
XR8VideoController | Video playback on targets (with proper material cleanup) |
XR8TrackerSettings | Quality presets (Performance/Balanced/Quality) |
GaussianSplatRenderer | WebGL-compatible Gaussian Splat rendering (GPU instanced, pre-allocated depth sort) |
GaussianSplatLoader | PLY/splat file parser (Mobile-GS compatible) |
The project has these Unity Asset Store plugins installed:
| Plugin | Folder | C# API | Purpose |
|---|---|---|---|
| Mesh Baker | Assets/MeshBaker/ | MB3_MeshBaker, MB3_TextureBaker | Mesh combining + texture atlasing |
| Mantis LOD Editor Pro | Assets/MantisLODEditor/ | Mantis.LODEditor namespace | Auto-LOD generation |
| Mesh Animator | Assets/MeshAnimator/ | MeshAnimator namespace | VAT baking (skeletal → texture) |
| GPU Instancer (Crowd) | Assets/GPUInstancer/ | GPUInstancer namespace | GPU instancing for objects + crowds |
| Amplify Shader Editor | Assets/AmplifyShaderEditor/ | Visual editor (not scriptable) | Visual shader graph |
| DOTween Pro | via Plugins/Demigiant/ | DG.Tweening namespace | Tweening: transform.DOMove() etc. |
| Animation Converter | Assets/AnimationConverter/ | Editor tool | Animation retargeting + compression |
| NaughtyAttributes | Assets/NaughtyAttributes/ | [Button], [ShowIf] attributes | Better inspector UX |
When writing code that uses these plugins, add appropriate #if guards or check for namespace availability.
In XR8ImageTracker inspector > Tracker Settings > Tracking Quality:
Two shaders for AR portal effect:
XR8WebAR/PortalMask — Stencil-only, renders no color (the invisible window)XR8WebAR/PortalInterior — Stencil-tested, only visible through portal maskBoth must share the same Stencil Reference value (default: 1).
Desktop Preview is activated and configured on the XR8Manager component Inspector, NOT the top menu bar.
To use it:
XR8Manager GameObject in your scene hierarchy.| Key (Static Mode) | Action |
|---|---|
T | Toggle tracking on/off |
Tab | Cycle through image targets |
Mouse Drag | Move target position |
Scroll Wheel | Adjust target distance |
R | Reset target position |
Esc | Lose tracking |
F | Toggle face found/lost |
1-5 | Expression presets (neutral/smile/surprise/wink/talk) |
Right-Click Drag | Move face position |
Sometimes a landscape image displays as portrait in Unity because phone cameras use hidden EXIF tags to rotate pixels, and standard Unity import ignores them. The Fix:
XR8TextureOrientationFixer.Assets folder -> Select XR8 -> Fix EXIF Orientation or use the manual 90° rotation options.To ensure a Video Overlay perfectly matches an Image Target in WebAR:
XR8 WebAR -> Image → Video Quick Setup wizard, which automatically calculates the correct exact physical quad size to perfectly align the overlay geometry using standard 1x1 primitive sizing mapped to localScale.WebGL-compatible (no compute shaders). Workflow:
XR8 WebAR > Import Gaussian Splat → browse/drag .ply or .splatnpx serve Build/ → open URL on phone (same WiFi)Assets/XR8WebAR/Runtime/Scripts/Assets/XR8WebAR/Runtime/Scripts/GaussianSplat/Assets/XR8WebAR/Runtime/Shaders/Assets/XR8WebAR/Runtime/Plugins/Assets/XR8WebAR/Editor/Assets/WebGLTemplates/8thWallTracker/xr8-bridge.jsAssets/WebGLTemplates/8thWallTracker/index.htmlThe project includes a Convai Web SDK integration for AI-powered talking characters in WebAR.
WebGLTemplates/8thWallTracker/) — JS bridge, same pattern as xr8-bridge.jsRuntime/Plugins/) — Unity C#↔JS interopRuntime/Scripts/) — Drop-on component for any character@convai/[email protected]XR8ConvaiCharacter component → paste Character ID + API Key8th Wall engine is self-hosted. There are NO app keys, NO cloud project IDs. The engine binary lives at Assets/WebGLTemplates/8thWallTracker/xr8.js. Never ask for or try to configure an 8th Wall app key.