I am working with the following while loop in GDScript:

while tunnels_carved < num_tunnels: ... . . tunnels_carved += 1 print("Generation at ", round(tunnels_carved / num_tunnels * 100), "%") 

This is contained within a method for an object that extends TileMap.

This issue I'm having is that none of the calls to print send anything to the output stream until the entire while loop is completed; at which point it spits out every line at the same time. If the code encounters a break-point during the while loop, the print functions begin to work as expected. Is there a way to force GDScript to print these strings before moving to the next iteration of the while loop?

I don't think the rest of the code in the while loop is pertinent, but if it is, I would be be more than happy to share it.

Edit: I've noticed the strings do get printed to the OS terminal window at the appropriate time. I suppose this will do well enough. If anyone knows how to get the Godot Editor's console to display these strings at the appropriate time, please let me know.

2

Related questions 0 Shell Script not entering a while loop. 0 Bash code: while loop does not work 1 While loop not working as intended. Google script Related questions 0 Shell Script not entering a while loop. 0 Bash code: while loop does not work 1 While loop not working as intended. Google script 0 Output not appearing 1 Why is this while loop not looping? 1 Bash While loop is not looping 0 While loop in Bash not running 2 While loop command and stdout processing 3 Can't print to console from within while-loop in R 0 bash while loop not cooperating? Load 7 more related questions Show fewer related questions

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.