OK, The pertentage value on the widget is a value from 0 to 1, (Not 0 to 100 !), so after divide your generated chunks by chunks to generate, do not multiply *100 again !
You only need a value from 0 to 1 so the resoult of your division is correct.
I have a problem with UMGs.
I have a voxel based map generated within the level blueprint with 2 for loops.
In the “Add Chunk” function a chunk actor is added. Before the start of the loops a UMG is displayed which should show the progress in percent and after each chunk the update function of my UMG is called to update the percentages
The update function is called, but it is not executed until the end of the loops. I am actually a programmer and hardly use Blueprints. But I assume that blueprints are not multi-threaded because the commands are executed at the end of the loops. Seems like they land in the stack
But I could be wrong, the map is created and the UMG jumps from 0 to 100% and then disappears after a second.
For debugging I print in the update function the momentary percentages, which are also printed only at the end.
I have absolutely no idea what I can do against it maybe you have an idea that I could try, thank you in advance xD
Here is the update function:
341410-
Some questions: Is your HUD a real HUD or an UMG widget? When do you create your chunks? What happens if you put a PrintString into your loop for debugging instead of your Update function? Did you try to use variables in the HUD and write to them from the loop (instead of going to GameMode and then back to the HUD)? Did you try to use an Interface?
I think you don’t understand the problem, either you read wrong xD or I expressed myself wrong.
I want to get 0-100% displayed and not 0-1% therefore also the *100 in the UMG
Nevertheless, this does not change my problem I know that the calculation is correct because I end up as soon as the chunks are generated the percentages jump from 0 to 100. But thanks for your answer
His assumption is not wrong, because when using a ProgressBar you would have to create a number from 0 to 1 to show as 0%-100% (you’re using a string here, but nevertheless :)). So please share some more details with us.
Hey sorry for the late feedback xD my phone just went bye-bye today ^^
To your question, the UMG is a user widget yes. I had also tried instead of calling the Udpate function to simply print a string, but with the same result. I am still of the opinion that all instructions end up in the stack and are only processed at the end. Changing the variables directly in the UMG didn’t help either
I haven’t tried an interface yet but I’ll give it a try and get back to you thanks!
Yes, that’s right, was also not meant badly
god this ■■■■■■ me off xD I have the same problem with an interface, also tried to use a custom actor instead of doing everything in level BP. But even that did not work… will see if I find a way, ideas are welcome^^
In your ForLoop, where you are adding your chunks, how many loops are being run? Can you PostString when you do it after ForLoopCompleted? Or how many Chunks do you create and how big are they? Could you show more of your code? Maybe you have too much calculations at once and have to divide it in smaller parts as a work-around
-
First thing you need to check: Are you using a widget progressbar from the UMG? Then you percent value need to be in format 0 to 1. Other thing is, if you want to show the percentage in numbers using a text, then you can use 0 to 100. But for the progress bar, be sure you use 0 to 1.
-
Are you using a custom pprogressbar in the Hud blueprint? ( not widget) then you can update the value of percent directly and be sure you paint the progressbar in the “event receive draw HUD” or create a custom event to update it
-
If you use a widget progressbar, you can access directly to the percent value instead of using the binding function, so you can directly push the value to your widget.
In the school where i give classes of unreal, i saw a lot of times the same problem in my students exercices, and the problen is always the same, they use 0 to 100 to feed the progressbar.
Hey thanks first for your answer, I don’t use a ProgressBar but a text yes By the way I think my naming convention causes some confusion^^ I only named the UMG widget “HUD” because I couldn’t think of another name in a hurry.
Thanks anyway!
I already thought that I might have too many calculations.
In my level BP I have the 2 for loops you have already seen. (It doesn’t matter how many loops I have in the level BP. Both loops have the same range, the problem appears at 2^2 or at 5^5 or 10^10).
However, it could be a bit harder with the chunk generation:
Since the chunks are also square (n*n) and I usually only use a depth of 1, this adds up to quite a bit of calculations.
For testing I had created a chunk with a dimenion of n=300 so 300x300 and a depth of 5. but the calculation was interrupted after a certain iteration and I had then only e.g. a dimension of 300x100.
To test the maximum I set the “Maximum Loop Iteration Count” in the Project Settings to 9 million to avoid problems.
So I could then have larger chunks created.
I should perhaps note that when I tested this, I only had one chunk generated. But now with the level BP I let create n*n chunks with 20x20x1. I was honestly too lazy to calculate how many iterations are calculated xD
But if we assume 3x3 chunks in the level BP which then creates 9 chunks with a dimension of 20x20x1 this should be 3600 iterations if I have calculated correctly now (9[chunks]* (20*20)[the chunk itself]) or not?
And even there I have the problem.
I’ll test your question on the picture and get back to you.
Even if I call the Udpate function or a simple PrintString after completing the 2nd for loop in level BP, the widget is updated only at the end of the 1st for loop