Delaying in C++ or workarounds

If your editor crashes before the string is printed no amount of delaying will change that. This is tagged as C++ question so I assume you are using Visual Studion or some IDE, why don’t you put a breakpoint in your code and step through it?

Ok, so in my project, the editor freezes whenever I get to a spot in my code. I’ve tried debugging uysing strings, but it freezes before the strings print. So, what I do is that I put a debug string and then a delay node in Blueprints. I have narrowed iut down to a C++ function. I need it to wait to run the next line of code until the debug line displays. How can I do this?

I’ve tried breakpoints, and when i print a string, delay, and run the code I’m, testing in blueprint, it works. I just need to figure out how to do it in c++.

There’s no delay functions in C++ (it’s usually a bad idea to rely on “time”). That said an easy-ish alternative could be Timers, it will allow you to run some code after a specified duration. It will require you to split your function in two though (one function that runs everything up until where you want the delay function, and the second that runs the rest). If i remember well, they work similarly in both bp and c++, if that’s of any help.

Gameplay Timers | Unreal Engine Documentation