Debug.log in a burst Job

Hi,

I’ve done a job on unity for some A* pathfinding. And when i run it with the burst compiler, i have this error:

Burst error BC1348: Unsupported string.Format method called. Calling the method System.String.Concat(object arg0, object arg1, object arg2) is not supported by Burst. Only string.Format(string, object) or string.Format(string, object, object) or string.Format(string, params object[ ] args) are supported.

As i understand it, the debug.log cannot be called inside a Burst Job? But in that’s case, is there a way to create a log file of what’s happening?

We did add some initial support for Debug.Log in Burst 1.3.0 - if you can provide your Debug.Log example from your code we might be able to tell you more.

Hi, thanks for your answer,
I uploaded my script in answer. There is only one Debug.Log line 207 (in the current job)
If there is some condition for a Debug.Log to work in a job. What conditions are they?

5954399–638132–Pathfinding.cs (10.4 KB)

Change your line to something like this:
Debug.Log (string.Format (“{0};{1}”, node.x, node.y));
Looking at your error message, this should do the trick (no string.concat)

Would this also work?
Debug.Log($“{node.x};{node.y}”);
IIRC this calls string.Format behind the scenes

Hi thanks for all your answer
I’ve tried this : Debug.Log($“{node.x};{node.y}”); or this Debug.Log (string.Format (“{0};{1}”, node.x, node.y));
I got this Burst error when i try : " Burst error BC1005: The try construction is not supported"
followed by :“Burst error BC1037: The try construction (e.g foreach/using) is not supported”

Right - foreach loops currently are not supported because they map down to a try {} finally {} underneath. Change the foreach loop to a for and it should now compile! :slight_smile:

Oh thanks for this precision, you’re right it compiles.
Thanks again.

1 Like