Would you build your game's UI in HTML, CSS and JS if the engine drew it natively? Lessons from building a runtime for it
retained text
Game UI kept being where our schedules slipped: mock it up in Figma, rebuild it in the engine's UI system, rebuild it again after review. The web solved most of these problems years ago, so I've been building a runtime that takes real HTML, CSS and JavaScript and renders it natively inside the engine. No Chromium, no WebView: the runtime lays out the page, runs the JS and hands a draw list to the engine.
A few things I learned along the way, in case you're weighing web tech for game UI:
- **"HTML-style" isn't HTML.** Most game UI libraries implement a subset, often Flexbox only. That holds until a designer reaches for Grid, container queries or a library from npm. Supporting the real specs was most of the work, and most of the value.
- **JavaScript in a game needs guardrails.** Consoles and iOS don't allow JIT, so scripts compile ahead of time to native code. Each UI also gets a script time budget and a generational GC, so the UI stays out of gameplay's way.
- **Gameplay should push state, not the UI poll it.** One `SetState("ammo", 25)` from C#, C++ or GDScript and the page reacts, which keeps per-frame script work tiny.
- **Gamepad navigation has to be automatic.** Nobody wants to wire focus by hand on every screen: spatial navigation by default, overridable when you need it.
- **Texture memory sneaks up on you.** UI art is big. Streaming images by visibility and staying within a RAM/VRAM budget mattered more than any layout optimisation.
- **Designers live in Figma.** A one-way import is useless after the first iteration: the sync has to merge property by property and keep the bindings and navigation devs added.
- **Iteration speed is the real win.** Saving the CSS and seeing it in the running game, with Chrome DevTools attached to the live game, changed how we build UI more than anything else.
Curious where you stand:
- What does your UI pipeline look like today, and where does it hurt?
- Would you trust web tech for a shipping game's UI? What would you need to see first: performance, memory, consoles, accessibility?
Full disclosure: the runtime is Mako UI, a commercial product for Unity, Unreal, Godot and custom C++ engines. I'm not linking it here to keep this a discussion, but I'll drop the video in the comments if anyone wants to see it.document fetched 2026-11-04 00:26 · canonical https://reddit.com/r/gamedev/comments/1xmozii/would_you_build_your_games_ui_in_html_css_and_js