Install from Package Manager:
https://github.com/MasterSix997/UBImGui.git
Note
No initial configuration is required
, not even prefabs, or render pipeline passes.
Everything starts automatically, but you can configure some features in "Edit/Project Settings/UB ImGui"
UB ImGui is an integration between "Unity" and Dear ImGui, without resource bloat, making it easy to modify and extend.
Using the binds provided by ImGui.Net which in turn uses the binds from cimgui.
And some code snippets from the archived dear-imgui-unity.
- Unity Versions
- ✅ Unity 2021
- ✅ Unity 2022
- ✅ Unity 6
- Platforms
- ✅ Windows
- ✅ Linux
- ✅ MacOS
- 🟨 Android (Only works on IL2CPP builds)
- ❌ WebGL (how run a "dll" in WebGL? Maybe with Emscripten?)
- ✅ Docking
- ✅ Textures
- ✅ BuiltIn Support
- ✅ URP Support
- ✅ HDRP Support
- ✅ Render In Front (With Coroutine)
- ✅ IL2CPP
- ✅ Input Manager
- ✅ Input System
- ✅ Custom Fonts
- ✅ Custom Cursors
- 🟨 FreeType (It's possible to implement, but needs a way to build "cimgui" for Mac and Linux)
- 🟨 GUI Scale with DPI or resolution (Currently need to scale manually)
✅ - Implemented
🟨 - Not implemented, but to be done
❌ - Not implemented and probably won't be
A demo Window with several usage examples.
Available online in web.
using ImGuiNET;
using UnityEngine;
public class ShowDemoWindow : MonoBehaviour
{
private void OnEnable()
{
ImGui.Layout += OnLayout;
}
private void OnDisable()
{
ImGui.Layout -= OnLayout;
}
private void OnLayout()
{
ImGui.ShowDemoWindow();
}
}
using ImGuiNET;
using UnityEngine;
public class SimpleWindow : MonoBehaviour
{
private void OnEnable()
{
ImGui.Layout += OnLayout;
}
private void OnDisable()
{
ImGui.Layout -= OnLayout;
}
// Fields to be used in the window
private bool enableFields;
// As this string is not serialized (public or [SerializeField]), it is necessary to initialize it before using
private string textValue = "";
private float sliderValue;
private Vector3 vector3Value;
private void OnLayout()
{
// Begin a new window called "Simple Window"
// If the window is collapsed, there is no need to create widgets (no need to call ImGui.End())
if (ImGui.Begin("Simple Window"))
{
// Add some text to the window
ImGui.Text("Im a text");
// If the button is clicked, log a message to the console
if (ImGui.Button("Click Me!"))
{
Debug.Log("Thanks :)");
}
// Add a checkbox to enable/disable fields
ImGui.Checkbox("Toggle Fields", ref enableFields);
// If fields are enabled, add widgets
if (enableFields)
{
// Add input fields for text, slider, and vector3
ImGui.InputText("Text Field", ref textValue, 100);
ImGui.SliderFloat("Slider Field", ref sliderValue, 0, 100);
ImGui.SliderFloat3("Vector3 Field", ref vector3Value, -10, 10);
}
// End the "Simple Window"
ImGui.End();
}
}
}