Search Unity

Feature Request script define symbol for burst compile

Discussion in 'Burst' started by Daniel_KIWI, May 16, 2021.

  1. Daniel_KIWI

    Daniel_KIWI

    Joined:
    May 23, 2017
    Posts:
    6
    When using the Burst compiler you can't really do Debug logs due to Limitations handling strings.
    But instead of commenting out all debug logs it would be great to have a define symbol to have the debug log code inside an #if #endif block to only compile with burst disabled.

    So for debugging could simply disable burst and have all debug logs working without having to uncomment them all.
     
  2. HellGate94

    HellGate94

    Joined:
    Sep 21, 2017
    Posts:
    132
    you can use debug log just fine within burst as long as its not working with string variables. even string interpolation works
     
  3. Daniel_KIWI

    Daniel_KIWI

    Joined:
    May 23, 2017
    Posts:
    6
    Hey, thanks for the reply.

    Interesting, had tried concatenating strings together with "" + "" which caused compile errors, will try string interpolation with $"" shortly.

    But still I think there might be other use cases where a define symbol for burst compile could be useful.
     
  4. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    The define isn't possible because we hook into C# after the frontend has done its thing, so any preprocessor define is already long since gone by the time Burst sees it.

    And yes - string interpolation should work for this usecase!
     
    Daniel_KIWI likes this.
  5. Daniel_KIWI

    Daniel_KIWI

    Joined:
    May 23, 2017
    Posts:
    6
    Ah ok, thanks for the clarification.
     
    sheredom likes this.