Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Resolved Debug.log in a burst Job

Discussion in '2020.1 Beta' started by miyoku, Jun 8, 2020.

  1. miyoku

    miyoku

    Joined:
    Nov 13, 2013
    Posts:
    8
    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?
     
  2. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    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.
     
  3. miyoku

    miyoku

    Joined:
    Nov 13, 2013
    Posts:
    8
    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?
     

    Attached Files:

  4. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    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)
     
  5. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    438
    Would this also work?
    Debug.Log($"{node.x};{node.y}");
    IIRC this calls string.Format behind the scenes
     
  6. miyoku

    miyoku

    Joined:
    Nov 13, 2013
    Posts:
    8
    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"
     
  7. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    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! :)
     
  8. miyoku

    miyoku

    Joined:
    Nov 13, 2013
    Posts:
    8
    Oh thanks for this precision, you're right it compiles.
    Thanks again.
     
    sheredom likes this.