ImGui.NET
ImGui.NET copied to clipboard
add Font then use with ImGui.PushFont case 'System.AccessViolationException'.
how i add Font
// create the object on the native side and wrap it in a C# class
ImFontConfig* nativeConfig = ImGuiNative.ImFontConfig_ImFontConfig();
var config = new ImFontConfigPtr(nativeConfig)
{
OversampleH = 2,
OversampleV = 1,
RasterizerMultiply = 1f,
MergeMode = true
};
ImGui.GetIO().Fonts.AddFontDefault();
_textFont = ImGui.GetIO().Fonts.AddFontFromFileTTF(@"C:\Windows\Fonts\Arial.ttf", 20f, nativeConfig);
// delete the reference. ImGui copies it
config.Destroy();
when i use
ImGui.PushFont(_textFont); // Here Error
drawer.AddText(new Vector2(50f, 50f), 0, $"pCount");
ImGui.PopFont();
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
Same problem here as well
https://github.com/mellinoe/ImGui.NET/issues/125#issuecomment-554942927 https://github.com/mellinoe/ImGui.NET/issues/132#issuecomment-525093161 https://github.com/mellinoe/ImGui.NET/issues/133#issuecomment-529652438
Did you solve it? I am currently facing the same problem