Problems with TextureProgressBar

Godot Version

4.3 stable

Question

Hi guys!
I was trying to add a very simple TextureProgressBar to reflect my character’s HP. I coded the thing, printed the results and it seemed to be working. I have one problem though : I wrote a very simple code to test things out and everytime I press a key (DOWN or UP), the value property is supposed to go down or up if possible. The print messages show the right value but the progress bar progresses after 3 hits of the key.
And for the life of me, I can’t say why!
I created this very small project to test things out a bit and I added an addon with a radiall progress bar. The later works but mine doesn’t.
If you’d be so kind as to have a look…It’s not very important and I can use a simple ProgressBar instead but that’s frustrating!
I’ve uploaded the test project on github for those who want to test for themselves!

The code is in control.gd

Thanks!

1 Like

One reason could be that your progress-bar is too small to render the small changes so it only updates after 3 changes

Hi. Your code working fine. Error in your textures.
Look at the size of texture in layout and size of texture itself.

Size in layout 64x64, BUT TEXTURE ITSELF 32x8?

Godot take full lenght of image (resource), not you texture. So this is very BAD idea to save textures like 64x64 and use 1/10 part of its canvas. And going far - every empty space in texture canvas will take RAM ANYWAY. If you gonna load 10K of images like that, dont be surprise getting terrifying optimization and lags.

Make it proper size and everything will work.

1 Like

@GorevAndrew and @herrspaten
Thanks for your replies! I’ll try changing the size of the texture.
I’m a beginner so working on optimization is not my number 1 priority but I’d like it to work so I’ll give it a shot!
Thanks :wink:

1 Like

About images sizes - in your case not about optimization) its about proper work with engine)

Sure! I didn’t know so I’m happy I do now :wink: Thanks again! I’ll try right away!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.