Needle Engine Documentation
Getting Started
Tutorials
How-To Guides
Explanation
Reference
Help
Getting Started
Tutorials
How-To Guides
Explanation
Reference
Help

UnityWorking with Unity Integration

Learn how Needle Engine brings Unity's powerful visual tools to the web—no code required for many features!

Before You Start

Make sure you have Needle Engine installed in Unity. See Unity Installation for setup instructions.


How Needle Engine Works with Unity

Needle Engine provides tight integration with the Unity Editor, allowing you to:

  • Design visually in Unity's familiar interface
  • Use built-in Unity features (shaders, lightmaps, animation, physics)
  • Export to optimized web formats automatically
  • See changes instantly with hot reload

Key Concept: Unity + glTF + Web

Needle Engine does NOT compile C# code to WebAssembly.

The workflow:

  1. Unity Editor - Design scenes, set up components, configure visual features
  2. glTF Export - Scene converts to glTF format automatically
  3. Web Runtime - Browser loads and displays your scene

Why? Small file sizes, fast loading, and works on any device with a browser.

Read more: Vision • Technical Overview

Video: Getting Started with Unity (16 minutes)

What Works Out of the Box

Many powerful features work without writing code!

🎬 Animation

Animate visually with Unity's powerful animation tools:

Unity Animator

Animator State Machines

Create complex animation behaviors without code:

  • Set up Animation Controllers in Unity
  • Define states and transitions
  • Use parameters to control animations
  • Add layers for animation blending

All exported and working on the web automatically!

Timeline Sequencing

Create cinematic sequences and cutscenes:

  • Timeline - Sequence animations, audio, and events
  • Playable Director - Control playback

Perfect for product showcases, architectural walkthroughs, and interactive stories.

Read more: Animation Components


⚙️ Physics

Visual physics setup - no coding required for basic interactions:

Add physics components in Unity:

  • Rigidbody - Objects respond to gravity and forces
  • Colliders - Define collision shapes (Box, Sphere, Mesh)
  • Physics Materials - Bounce, friction properties
  • Joints - Connect rigidbodies with constraints

Configure visually:

  • Mass, drag, and gravity settings
  • Collision layers and masks
  • Trigger zones (Is Trigger checkbox)
  • Constraints (freeze position/rotation)

Everything exports and works on the web with the Rapier physics engine!

Read more: Physics Setup


UnityShaders & Materials

Create beautiful materials visually with Unity's tools:

Shader Graph Example
  • PBR Materials - Standard/URP materials export automatically
  • Shader Graph - Node-based shader creation without code
  • Custom Shaders - Export shader variants and properties

What you can adjust:

  • Colors, textures, and material properties
  • Metallic, roughness, emission
  • Transparency and rendering modes
  • Shader properties (exposed as material properties)

Artists can create shaders in Unity and Needle Engine handles the conversion to web-compatible shaders automatically.

Read more: Materials & Shaders


💡 Lightmaps

Bake beautiful lighting in Unity and it appears on the web automatically:

lightmaps

Setup (no code required):

  1. Mark objects as Static in Unity
  2. Add lights or use emissive materials
  3. Click Generate Lighting
  4. Needle Engine exports lightmaps automatically

Works with:

  • Unity's built-in lightmapper
  • Third-party solutions like Bakery
  • Multiple scenes with independent lightmaps

Recommended Unity Lightmap Settings

For best performance and quality on the web:

  • Lightmap Encoding: Normal Quality (adjust in Project Settings > Player)
  • Progressive GPU (faster and usually accurate enough for small scenes)
  • Non-Directional Lightmaps
  • Max Lightmap Size: 2k (you can go higher, but expect large files)
  • Max 4× 2k lightmaps per scene (you can go higher, but expect large files)
  • Compress Lightmaps: OFF (increases quality; otherwise compressed again at export)

lightmap settings

Working with multiple scenes: Disable "Auto Generate" and bake lightmaps explicitly. Otherwise, Unity will discard temporary lightmaps on scene change.

Mixing Baked and Non-Baked Objects

For best results when mixing baked and non-baked objects, use these Unity lighting settings:

Environment Lighting: Skybox
Ambient Intensity: 1
Ambient Color: black

Unity 2021.3+:
Unity 2021.3+ settings

Unity 2020.3+:
Unity 2020.3+ settings

If you have no baked objects in your scene, these settings also work:

Environment Lighting: Color
Ambient Color: any

What you see in Unity is what you get on the web!

Read more: Lightmaps


🎨 Post-Processing

Add professional visual effects with post-processing:

  • Bloom - Glowing highlights
  • SSAO - Ambient occlusion for depth
  • Depth of Field - Focus effects
  • Color Correction - Adjust tone and mood
  • Tonemapping - Control exposure and contrast

Add a Volume component to your camera and configure effects visually in Unity. Effects work on all devices!

See all post-processing components


🎨 Particle Systems

Create stunning visual effects:

Unity's Particle System works on the web! Configure particles visually:

  • Emission rates and bursts
  • Particle lifetime and size
  • Colors and gradients
  • Forces and velocity
  • Collision and sub-emitters

Great for fire, smoke, sparkles, rain, and magical effects.


🖼️ UI Canvas

Build interactive UI without code:

Unity's Canvas system works on the web:

  • Buttons, text, images, and input fields
  • Layout groups for responsive design
  • Screen space and world space UI
  • Event triggers for interactions

Perfect for HUDs, menus, and interactive elements.

Read more: UI Components


👥 Multiplayer (No Code)

Add multiplayer with built-in components:

  • SyncedRoom - Automatic room creation and joining
  • SyncedTransform - Sync object positions automatically
  • SyncedCamera - See other users' viewpoints
  • Voip - Voice chat with spatial audio

Just add components in Unity - no networking code needed!

Read more: Networking Setup


🥽 XR/AR Support

VR and AR with visual setup:

  • WebXR component - Enable VR/AR mode
  • XR Rig - Configure VR camera and controllers
  • AR Session Root - AR placement and scale
  • XR Flag - Show/hide objects in VR/AR

Works on Meta Quest, Apple Vision Pro, and AR on mobile devices!

Read more: XR Setup


Scene Structure & GameObjects

GameObject Hierarchy

Your Unity hierarchy exports directly to the web:

  • Parent-child relationships maintained
  • Transform data (position, rotation, scale)
  • Object names preserved
  • Active state and visibility

Key concept: In three.js/Needle Engine, GameObject and Transform are the same object (Object3D).

Components

Built-in Unity components that work on the web:

  • Camera
  • Light (Directional, Point, Spot)
  • MeshRenderer / SkinnedMeshRenderer
  • MeshFilter
  • AudioSource
  • And many more!

See all built-in components


Quick Reference: Unity → Needle Engine

Unity ConceptNeedle EngineNotes
GameObjectObject3DSame object in three.js
TransformObject3DNo separate Transform component
MonoBehaviourBehaviourBase class for components
C# ScriptsTypeScript/JavaScriptRuntime behavior
Static (Lightmap)Automatic exportJust mark as Static
Animator ControllerAnimator componentState machines work!
Physics MaterialPhysicsMaterialFriction/bounce settings
Canvas UICanvas componentWorld and screen space
UnityEventEventListUse @serializable(EventList)
positionLocal spaceUse worldPosition for world

glTF Export

When you save your Unity scene, Needle Engine automatically exports to glTF format (.glb or .gltf).

What Gets Exported

Visual Assets:

  • Meshes and geometry
  • Materials and textures
  • Lightmaps and skyboxes
  • Animations and blend shapes
  • Particle systems
  • Audio files

Scene Data:

  • GameObject hierarchy
  • Transform data
  • Component configurations
  • References between objects

Optimization:

  • Automatic texture compression (KTX2)
  • Mesh compression (Draco)
  • Progressive loading for large scenes
  • LOD (Level of Detail) support

Read more: Export & Optimization


Web Project Structure

When Needle Engine creates a web project, you get:

YourUnityProject/
└── Assets/

YourWebProject/              ← Generated web project
├── assets/
│   └── scene.glb            ← Exported glTF scene
├── src/
│   ├── main.ts              ← Entry point
│   └── scripts/             ← Custom components (optional)
├── package.json
└── vite.config.js

Project location: By default, created next to your Unity project. Configure in the Needle Engine component.


Editor Sync & Hot Reload

See changes instantly without rebuilding:

Add the EditorSync component to enable live sync:

  1. Make changes in Unity (move objects, adjust materials, change properties)
  2. Save the scene (Ctrl+S / Cmd+S)
  3. Browser updates automatically!

What syncs:

  • Transform changes
  • Material properties
  • Component field values
  • Hierarchy changes

Code hot-reload: TypeScript changes also reload automatically when you save.

Video: From Unity Project to Live Sync with three.js (4 minutes)

Read more: Editor Sync


Adding Custom Behavior (Optional)

While many features work without code, you can add custom interactivity with TypeScript:

TypeScript workflow:

  1. Write TypeScript components in src/scripts/
  2. C# stubs generate automatically in Unity
  3. Add components to GameObjects visually
  4. Configure properties in the Inspector

Common use cases:

  • Custom interactions (click, hover)
  • Game logic and rules
  • Data loading and APIs
  • Complex animations
  • Custom UI behavior

Learn scripting:

  • Create Components - Write custom components
  • C# to TypeScript Translation - For Unity developers
  • TypeScript Essentials - Language basics

Framework Integration

Needle Engine works with any web framework:

  • Vue.js - Reactive UI framework
  • React - Component-based UI
  • Svelte - Lightweight and fast
  • Next.js - React with server rendering
  • And more!

The default template uses Vite for fast development.

See framework samples


What's Next?

Continue Learning

For Unity Users:

  • Unity Getting Started - Step-by-step setup tutorial
  • For Unity Developers - Complete learning path

Add Custom Behavior:

  • Create Components - Write interactive code
  • C# to TypeScript - Translate your C# knowledge

Explore Features:

  • Component Reference - All built-in components
  • Samples & Showcase - See what's possible

Get Help

  • FAQ - Common questions
  • Discord Community - Live support
  • Forum - In-depth discussions
Suggest changes
Last Updated: 1/28/26, 3:00 PM

On this page

Extras

Copy for AI (LLMs)