realgamessoftware / dear-imgui-unity

Unity package for Dear ImGui
MIT License
462 stars 112 forks source link

Render issue on 2019.3.0f6 w/ Built-In render pipeline #25

Open smoore2171 opened 3 years ago

smoore2171 commented 3 years ago

I've pulled this in and updated cimgui.dll to 1.78, which resolved the errors on startup, but it doesn't render anything with ImGui.ShowDemoWindow (the layout register works and it does hit this method in the OnLayout with the Unity Built-In Renderer.

If I try a simple window ImGui.Begin("foo"); ImGui.TextUnformatted("barr"); ImGui.End();

I get the following null ref:

ArgumentNullException: Value cannot be null. Parameter name: value UnityEngine.MaterialPropertyBlock.SetTexture (System.Int32 nameID, UnityEngine.Texture value) (at <f38c71c86aa64e299d4cea9fb7c715e1>:0) ImGuiNET.Unity.ImGuiRendererMesh.CreateDrawCommands (UnityEngine.Rendering.CommandBuffer cmd, ImGuiNET.ImDrawDataPtr drawData, UnityEngine.Vector2 fbSize) (at D:/Downloads/dear-imgui-unity-master/dear-imgui-unity-master/ImGuiNET.Unity/Renderer/ImGuiRendererMesh.cs:160) ImGuiNET.Unity.ImGuiRendererMesh.RenderDrawLists (UnityEngine.Rendering.CommandBuffer cmd, ImGuiNET.ImDrawDataPtr drawData) (at D:/Downloads/dear-imgui-unity-master/dear-imgui-unity-master/ImGuiNET.Unity/Renderer/ImGuiRendererMesh.cs:76) ImGuiNET.Unity.DearImGui.Update () (at D:/Downloads/dear-imgui-unity-master/dear-imgui-unity-master/ImGuiNET.Unity/DearImGui.cs:157)

In ImGuiRendererMesh, _texManager.GetTexture((int)(prevTextureId = drawCmd.TextureId)) is returning null. The TextureId being sent in is some large value, but the texture manager only has the atlas texture registered to it with ID 1.

I notice it tries to create textures in this manager if GetTextureId is called, but this doesn't appear to be done for anything except ImGui.Image* calls.

psydack commented 3 years ago

I've updated to version 1.84 with more features, you can check here https://github.com/psydack/uimgui