On Godot v4.5.1 with CSharp using GDScript ResourceLoader won't load texture passed into IMGUI properly, unless it was used in some other control node before.
This example will render an empty rect, unless I uncomment # TexturePreviewRect.texture = tex.
@export var TexturePreviewRect : TextureRect
...
static func getNationFlag(tag: String) -> Resource:
return load("res://gfx/flags/" + tag + ".png")
func DisplayNationWindow(nationId: int) -> void:
...
var tex = getNationFlag(nation["tag"]);
ImGui.Image(tex, tex.get_size() / 2)
# TexturePreviewRect.texture = tex
...