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

Invalid IL code in BuildRenderInstancedAnimationBlock:OnUpdate

Discussion in 'DOTS Animation' started by Guedez, Mar 12, 2020.

  1. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    827
    It started to happen after I created these two jobs in my system
    Code (CSharp):
    1. NativeArray<int> jboundsSizes = boundsSizes;
    2.         int currentTotal = 0;
    3.         bool all1 = false;
    4.         int failsafe = 10;
    5.         while (!all1 && failsafe-- > 0) {
    6.             all1 = true;
    7.             for (int jj = 0; jj < jboundsSizes.Length; jj++) {
    8.                 if (jboundsSizes[jj] > 1) {
    9.                     all1 = false;
    10.                     int perCycle = jboundsSizes[jj] / 16;
    11.                     int rest = jboundsSizes[jj] % 16;
    12.                     perCycle += rest == 0 ? 0 : 1;
    13.                     jboundsSizes[jj] = perCycle;
    14.                     for (int j = 0; j < perCycle; j++) {
    15.                         int start = j * 16;
    16.                         NativeArray<AABB> jbounds = bounds;
    17.                         NativeArray<AABB> jbounds2 = bounds2;
    18.                         if (j == perCycle - 1 && rest != 0) {
    19.                             jobs.Add(Job.WithCode(() => {
    20.                                 MinMaxAABB b = (MinMaxAABB)jbounds[start];
    21.                                 for (int l = 1; l < rest; l++) {
    22.                                     b.Encapsulate(jbounds[start + l]);
    23.                                 }
    24.                                 jbounds2[currentTotal + j] = (AABB)b;
    25.                             }).WithoutBurst().Schedule(comb));
    26.                         } else {
    27.                             jobs.Add(Job.WithCode(() => {
    28.                                 MinMaxAABB b = (MinMaxAABB)jbounds[start];
    29.                                 for (int l = 1; l < 16; l++) {
    30.                                     b.Encapsulate(jbounds[start + l]);
    31.                                 }
    32.                                 jbounds2[currentTotal + j] = (AABB)b;
    33.                             }).WithoutBurst().Schedule(comb));
    34.                         }
    35.                     }
    36.                     comb = JobHandle.CombineDependencies(jobs.AsArray());
    37.                     jobs.Clear();
    38.                     currentTotal += perCycle;
    39.                 } else {
    40.                     currentTotal++;
    41.                     bounds2[currentTotal] = bounds[currentTotal];
    42.                 }
    43.                 NativeArray<AABB> tmp = bounds2;
    44.                 bounds2 = bounds;
    45.                 bounds = tmp;
    46.             }
    47.         }
    It is meant to take a array of AABB bounds and combine it in a couple of them, the whole array actually represents an array of array, so jboundsSizes is used to discern when one starts and ends.

    The issue is that the whole Update method is broken now, I can't place break points to try to figure out anything, even an break point at the very start of the method breaks.
    Neither
    WithoutBurst()
    nor
    .Run()
    have helped
     
  2. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    827
    Updating all packages fixed it