Discovering LVGL for Embedded GUIs in Unity
As a solo dev of Spaceship Adventures, I’m constantly on the lookout for lightweight, embeddable UI frameworks. Recently, I came across LVGL—a C-based graphics library designed for microcontrollers and single-board computers. Even better, it can be bridged into Unity as a native plugin, letting me craft interactive, performant dashboards on Raspberry Pi–powered displays.

Why LVGL?
LVGL offers a rich widget set, theming, animations, and a low memory footprint—ideal for embedded SBCs. By rendering into a framebuffer, it decouples nicely from Unity’s Texture2D, giving me pixel-perfect control over each panel.

Embedding into Unity
To integrate LVGL with Unity, I built a shared library (.so) that initializes LVGL, ticks its task handler, and exposes the framebuffer pointer. In Unity C#, I import these functions, copy the framebuffer into a Texture2D each frame, and forward touch events—seamlessly blending embedded UIs into my game scenes.

Scaling Across Panels
For my proof-of-concept, I’m testing both single-Pi and multi-Pi setups. Each Pi Zero W drives one or two small screens, fetching JSON payloads over MQTT for dynamic content updates. Here’s a look at my cluster setup:

Next Steps
- Refine the plugin for thread safety and double buffering.
- Design themed LVGL widgets matching Spaceship Adventures’ sci-fi style.
- Automate content pushes from my Flask-based server.
Disclaimer
This post is for informational purposes and reflects my ongoing experimentation. Details may change as development continues.
Blog