You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m experiencing an issue with the integration of ImGui in my Unity project. I have a script using UImGui, and even when I set the p_open variable to false, the window still appears. And when i click the top right cross for closing the windows, the windows stay open (the windows blink ).
To Reproduce
Steps to reproduce the behavior:
Create a new scene
Add SampleDemoWindow
Attach linked script to SampleDemoWindow
Setup UImGui script (Render feature, camera )
Play
The window should be close but it appears
Version/Branch of UImGui:
Version: 5.0.0
Unity Version
2022.3.19f1
Render pipeline (HDRP / URP / Built-in)
URP
Expected behavior
The window should not be displayed when p_open is set to false.
Standalone, minimal, complete and verifiable example:
using UnityEngine;
using ImGuiNET;
public class TestUImGUI : MonoBehaviour
{
[SerializeField]
private UImGui.UImGui _uimGuiInstance;
private bool _isOpen = false;
private void Awake()
{
if (_uimGuiInstance == null)
{
Debug.LogError("Must assign a UImGuiInstance or use UImGuiUtility with Do Global Events on UImGui component.");
}
_uimGuiInstance.Layout += OnLayout;
}
private void OnLayout(UImGui.UImGui obj)
{
_isOpen = false;
if (!ImGui.Begin("Test Window", ref _isOpen))
{
ImGui.End();
return;
}
ImGui.Text("Hello, World!");
ImGui.End();
}
private void OnDisable()
{
_uimGuiInstance.Layout -= OnLayout;
}
}
The text was updated successfully, but these errors were encountered:
I believe this may just be an incorrect example in the repo. Looking at the official example from the ImGui.NET library used by uimgui, ImGui.Begin will always return true if the command executed successfully, and then assign closed status to the _isOpen bool which needs to be checked separately.
if(_showAnotherWindow){ImGui.Begin("Another Window",ref_showAnotherWindow);ImGui.Text("Hello from another window!");if(ImGui.Button("Close Me"))_showAnotherWindow=false;ImGui.End();}
Describe the bug
Hello,
I’m experiencing an issue with the integration of ImGui in my Unity project. I have a script using UImGui, and even when I set the p_open variable to false, the window still appears. And when i click the top right cross for closing the windows, the windows stay open (the windows blink ).
To Reproduce
Steps to reproduce the behavior:
Version/Branch of UImGui:
Version: 5.0.0
Unity Version
2022.3.19f1
Render pipeline (HDRP / URP / Built-in)
URP
Expected behavior
The window should not be displayed when p_open is set to false.
Standalone, minimal, complete and verifiable example:
The text was updated successfully, but these errors were encountered: