/ImGuiPlugin

ImGui plugin for unreal engine

Primary LanguageC++MIT LicenseMIT

ImGuiPlugin

A simple plugin for integrating Dear ImGui in Unreal Engine 5.

⚠️About

  • The plugin is not production ready.
  • The plugin is just something silly built to add QOL improvements to editor.
  • The plugin is not compatible with UE4.

Installation

  • Clone the repo in GameProject/Plugins folder along with submodule dependency
    git clone --recurse-submodules git@github.com:amuTBKT/ImGuiPlugin.git
  • ImGui and Implot binaries need to be compiled separately. The way unreal build setup works makes it difficult to include third party libraries, so they have to be compiled separately.
    Source/Thirdparty/ImGui/Build.bat, might require some modifications to patch cmake reference and setting compiler options (visual studio version etc)
    Running the batch script should generate required libs under "/ImGuiPlugin/Source/Thirdparty/ImGui/Binaries" and "/ImGuiPlugin/Source/Thirdparty/ImGui/Intermediate" directories.
  • Include the plugin in your own modules.
  • Feel free to use ImGuiExamples as reference.

👷Usage

ImGuiExamples 😅

At it's core the plugin is just a Slate widget with ImGui renderer, yes it's that simple :)
The plugin manages a global widget/window which can be used to add global widgets (managers, stats visualizer etc.)
User can also create SImGuiWidget widget which works like any other Slate widget with an addition of Tick delegate which can be used to add ImGui widgets.

Adding to main window

  • Using IMGUI_REGISTER_STATIC_WIDGET(InitFunction, TickFunction)
  • Dynamically binding to main window delegate
    FImGuiRuntimeModule& ImGuiRuntimeModule = FModuleManager::GetModuleChecked<FImGuiRuntimeModule>("ImGuiRuntime");
    MainWindowTickHandle = ImGuiRuntimeModule.GetMainWindowTickDelegate().Add(TickDelegate);`
    

Creating a standalone window

FImGuiRuntimeModule& ImGuiRuntimeModule = FModuleManager::GetModuleChecked<FImGuiRuntimeModule>("ImGuiRuntime");
ImGuiWindow = ImGuiRuntimeModule.CreateWindow("TestWindow", { 300., 300. }, TickDelegate);

Creating a slate widget

Users can create SImGuiWidget widget and add them to viewport or Slate containers, works similar to any other slate widget.