This Unity project is responsible for generating the playable WebGL worlds from dream blueprints.
- Open this folder as a Unity project (Unity 2022.3 LTS or later recommended)
- The main scene should contain:
- Main Camera with
FirstPersonControllerscript - Directional Light
- BlueprintLoader GameObject with the
BlueprintLoaderscript attached - WeatherParticles GameObject with a Particle System
- Main Camera with
Create and assign these prefabs in the BlueprintLoader component:
- BirdPrefab: A simple bird model (can be a cube with wings)
- TreePrefab: A tree model (low-poly tree for performance)
- HousePrefab: A house model (simple cube house)
- PersonPrefab: A character model (simple humanoid)
- TerrainPrefab: A terrain plane or Unity terrain
The BlueprintLoader.cs script expects JSON in this format:
{
"world": "forest",
"time": "night",
"weather": "feathers_rain",
"goal": "follow_bird_to_flying_house",
"characters": [
{ "type": "bird", "role": "guide" },
{ "type": "house", "float": true }
],
"style": "lowpoly",
"mood": "mystic"
}- File → Build Settings
- Select WebGL platform
- Click "Switch Platform"
- Set "Compression Format" to Disabled (for easier debugging) or Gzip
- Build to
/frontend/public/webgl/{jobId}/ - The build will create:
index.htmlBuild/folder with .wasm, .data, .framework.js, .loader.js
Place test blueprint.json files in Assets/StreamingAssets/ for testing in the Editor.
When deployed, the WebGL build can receive the blueprint URL via:
https://yoursite.com/webgl/job123/index.html?blueprintUrl=/v1/jobs/job123/blueprint
You'll need to add a first-person controller script or use Unity's Starter Assets package:
- WASD/Arrow keys for movement
- Mouse for looking around
- Spacebar for jump
For production deployment:
- Optimize builds: Enable compression, strip unnecessary code
- Asset optimization: Use texture atlases, LOD systems
- Loading screens: Add custom loading UI
- Error handling: Graceful fallbacks if blueprint fails to load
- Performance: Target 60 FPS on mid-range hardware
- Mobile: Consider mobile WebGL builds with touch controls
- Cloud Build: Integrate with Unity Cloud Build for automated builds