realgamessoftware / dear-imgui-unity

Unity package for Dear ImGui
MIT License
466 stars 115 forks source link

fix SetMesh warning #24

Open oceancx opened 3 years ago

oceancx commented 3 years ago

get warning in unity2020.3.0f1c1

SetSubMesh #1 shares part of its index buffer with SubMesh #2. Sharing part of an index buffer can result in undefined behavior and will be deprecated soon. To future-proof your Project, fix the indexStart/indexCount UnityEngine.Mesh:SetSubMesh (int,UnityEngine.Rendering.SubMeshDescriptor,UnityEngine.Rendering.MeshUpdateFlags) ImGuiNET.Unity.ImGuiRendererMesh:UpdateMesh (ImGuiNET.ImDrawDataPtr,UnityEngine.Vector2) (at Packages/dear-imgui-unity/ImGuiNET.Unity/Renderer/ImGuiRendererMesh.cs:127) ImGuiNET.Unity.ImGuiRendererMesh:RenderDrawLists (UnityEngine.Rendering.CommandBuffer,ImGuiNET.ImDrawDataPtr) (at Packages/dear-imgui-unity/ImGuiNET.Unity/Renderer/ImGuiRendererMesh.cs:71) ImGuiNET.Unity.DearImGui:Update () (at Packages/dear-imgui-unity/ImGuiNET.Unity/DearImGui.cs:157)

Themperror commented 3 years ago

Please do not allocate a new List<> every time that UpdateMesh is called, cache it outside the function and call Clear() on it

oceancx commented 3 years ago

Please do not allocate a new List<> every time that UpdateMesh is called, cache it outside the function and call Clear() on it

done

sandrofigo commented 3 years ago

I'd like to see this fixed in the next version, but just out of curiosity where does commit de89418b116bfc0b4e48da1fe220a5f5170e6392 come from?

oceancx commented 3 years ago

I'd like to see this fixed in the next version, but just out of curiosity where does commit de89418 come from?

this commit is only useful for our inner project, you can ignore it...

IvanXuff commented 1 year ago

you should put descriptors.Clear(); after int idxOf = 0; , otherwise you can not draw all wanted mesh

oceancx commented 1 year ago

you should put descriptors.Clear(); after int idxOf = 0; , otherwise you can not draw all wanted mesh

you are right!