Sitemap

IMGUI in Unity

5 min readJan 25, 2025
Press enter or click to view image in full size
ImGui Code Section

Unity is a game engine that may appear simple at first glance, but in reality, it’s a powerful tool. Although there are some minor flaws, it offers many features with significant technical depth. One such feature is the IMGUI (Immediate Mode GUI) system, which showcases the strength of Unity.

The IMGUI technique was developed by Casey Muratori in 2002. Notable implementations include Omar Cornut’s Dear ImGui (written in C++) and Nic Barker’s Clay (written in C). This article will focus on the basic usage and syntax of Unity’s IMGUI. We will explore how IMGUI works in Unity through code examples and explain how it achieves the so-called stateless behavior.

Features of IMGUI

Immediate Mode GUI (IMGUI) is a way of dynamically generating user interfaces. Unlike traditional “Retained Mode GUI,” the IMGUI interface is redrawn every frame. It does not maintain the persistent state of UI elements but instead defines and renders the UI immediately within each frame.

Immediate Rendering:
IMGUI’s interface is rendered “immediately,” meaning that UI elements are recalculated and drawn every frame. This requires redefining the layout and state of the UI in each frame, and the state of UI elements (such as whether a button is clicked) is typically controlled and passed through the code.

--

--

No responses yet