thisdp/dgs

dxbutton iconImage doesn't update

ERAGON007 opened this issue · 1 comments

local btn = dgsCreateButton(0.15, 0.2, 0.3, 0.2, "A simple button", true)
dgsSetProperties(
    btn,
    {
        ["iconImage"] = ":ThisResource/Files/SomeImage.png",
    }
)

The first problem is that dgs won't load the image if you simply use relative path to current resources files, e.g ("File/Images/SomeImage.png")

and the second one works but if you change the file server-side and restart that resource, the texture won't get updated

Solution:
Maybe we can attach an event handler with onClientResourceStart/Stop when a file get's loaded from that resource and reload the textures loaded from that resource into dgs

maybe because MTA doesn't clear the cache of that path.
That's why i always recommend to use dxCreateTexture