Can you debug inside a bursted/scheduled job?

Is there a way to debug inside this code block? I presume I cannot atm because it’s on a separate thread. I suppose I’m limited to printing out statements or… Looking for any recommendations, thanks in advance.

var someHandle = Entities
    .WithName("asd")
    .WithBurst(FloatMode.Default, FloatPrecision.Standard, true)
    .ForEach((Entity entity, int entityInQueryIndex) =>
    {
        int debugHerePlz = 1+1;
    }).ScheduleParallel(Dependency);

Maybe there is something I can change to effect how the code processes for debugging purposes turning on/off these settings?

6585739--748108--debughelp.png

For regular jobs with a burst you can debug them through native debugger:
https://docs.unity3d.com/Packages/com.unity.burst@1.4/manual/docs/DebuggingAndProfiling.html

And you can see video from @Lee_Hammerton

Plus look this video from him :slight_smile:

But ForEach is not supported for debugging with burst for now:
https://docs.unity3d.com/Packages/com.unity.burst@1.4/manual/docs/KnownIssues.html#known-issues-with-debuggingprofiling
As a workaround, you can disable burst for a specific job ( .WithoutBurst() ) or through Jobs menu for the whole app.

1 Like

Thanks for the info+references! I believe I’ve seen the second one but it’s hard to retain stuff like that until I get my hands dirty which at this point I have a little, will give it another looksies.

@eizenhorn 1st video was helpful just to see someone else step through it and interesting how they went through the effort for handling the threading. I realized I didn’t even specify what coding environment I’m using, vs code w/ the unity debugger extension. I coincidentally was going to write a very similar c# method for generating noise so I will be doing some c/p here shortly :slight_smile: And as far as the second video, it was meh for the level I’m at, I feel like I’m more at the 100 foot level at this point which is more reassuring than anything.

Turning off burst compilation allowed me to debug that burst job which makes sense when I think about it that whole block of code gets compiled into it’s native variant so that breakpoint theoretically never exists at that point.

God forbid I need to debug and isolate an individual burst job at some point, hopefully if one fails they all fail :eyes:

Thanks again :slight_smile:

PS your game looks cool and a good use case for having loads of entities & is now wishlisted :slight_smile: :slight_smile:

2 Likes