Debugging Scripts

Hey there. I’ve been trying to resolve some bugs in my script and so I tried to add some breakpoints but they don’t seem to work? How do I create breakpoints and step through my script? Am I missing something obvious?

Could you give me some more details on this. First, you are sure that the code is being executed via some println output?

Do you see the red breakpoint icon in the IDE?

Can you show me a snippet of code you are breakpointing? Is it a coroutine? Is it inside a loop? What data types are involved?

That’s weird, last night it didn’t work and this morning everything is fine?

My process was

  1. Start the game in an editor window,
  2. Click on a line of code in the IDE,
  3. From the Debug menu select ‘Add Breakpoint’.

Last night, I wasn’t even able to get the red breakpoint icon to appear.

Now I’m just dealing with the UE4 editor crashing frequently while stepping through code.

I will reboot and then attempt to find reliable ways to reproduce.

I can reliably reproduce the editor crashes in this file, though it seems to happen everywhere. Without any breakpoints, the game runs correctly.

() 
[
  _on_actor_hit_do
  [
    if other_actor.actor_has_tag("Wall">>) // breakpoint here crashes editor reliably
    [
      @speed *= -1  // also here
    ]
    
  ]
]

Another example, though in this case I was able to step through the code a few times before it crashed:

  !start_loc : Vector3!xyz(500, actor_location.@y, actor_location.@z) // breakpoint here crashed after stepping through the code a few times
  !final_loc : actor_location
  
  @fly_in_curve._play
  [
    actor_location_set(MathLib.vlerp(start_loc, final_loc, value), true)
  ]
1 Like

I will take a look at repro’ing this, it sounds like there’s a bug here.

1 Like

Thanks. Let me know if there’s anything I can do to help!

Ok, so I was able to reproduce this. I also found another debugger crash triggered sometimes when stepping over the end of a section of code and into another file.

I’ve just pushed a fix for both of these to the master branch if you could test it out.

I also experienced some of the inconsistencies you mentioned when adding breakpoints. I’ve added a bug for that as well but that is for another day.

The fix appears to have worked. The debugger is no longer crashing. Many thanks.