Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question I think I've messed up Burst Compile

Discussion in 'Burst' started by stroibot, Oct 15, 2022.

  1. stroibot

    stroibot

    Joined:
    Feb 15, 2017
    Posts:
    91
    I have a job and if comment out [BurstCompile] attribute it works fine, but if I run it with this attribute then I get errors like `System.IndexOutOfRangeException: Index {0} is out of range of '{1}' Length.`.
    If I disable Safety Checks then the code will work fine as well.
    So, did I messed something up?
    Unity 2022.1.17f1 and Burst package is at 1.7.3.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,533
    How about sharing your code? ;)
     
  3. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,222
    Disable Burst and leave safety checks on and you will find out what {0} and {1} actually are. For some reason, string interpolation in exceptions in Burst don't work properly. That exception was thrown from some sort of safety check, which is why you don't see it when disabling safety checks.