DOTS / ECS: Burst error BC1022: Accessing a managed array is not supported
I am getting the following stack trace on my application, and I am stuck on this. Could someone help me out?
 C:\wkspaces_nvme\PEP 2019.3\Assets\PenseCre\Scripts\GraphSystem_ForEach.cs(57,17): Burst error BC1022: Accessing a managed array is not supported
 
  at GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0.OriginalLambdaBody(GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0* this, ref Unity.Transforms.Translation translation, ref Unity.Transforms.NonUniformScale scale, ref Graph_ForEach graphComponent) (at C:\wkspaces_nvme\PEP 2019.3\Assets\PenseCre\Scripts\GraphSystem_ForEach.cs:57)
  at GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0.IterateEntities(GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0* this, ref Unity.Entities.ArchetypeChunk chunk, ref GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0.LambdaParameterValueProviders.Runtimes runtimes)
  at GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0.Execute(GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0* this, Unity.Entities.ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
  at Unity.Entities.JobChunkExtensions.JobChunkProducer`1<GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0>.ExecuteInternal(ref Unity.Entities.JobChunkExtensions.JobChunkWrapper`1<GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0> jobWrapper, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) (at C:\wkspaces_nvme\PEP 2019.3\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\IJobChunk.cs:271)
  at Unity.Entities.JobChunkExtensions.JobChunkProducer`1<GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0>.Execute(ref Unity.Entities.JobChunkExtensions.JobChunkWrapper`1<GraphSystem_ForEach.<>c__DisplayClass_OnUpdate_LambdaJob0> jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) (at C:\wkspaces_nvme\PEP 2019.3\Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Entities\IJobChunk.cs:245)
 
 
 While compiling job: System.Void Unity.Entities.JobChunkExtensions/JobChunkProducer`1<GraphSystem_ForEach/<>c__DisplayClass_OnUpdate_LambdaJob0>::Execute(Unity.Entities.JobChunkExtensions/JobChunkWrapper`1<T>&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)
 at C:\wkspaces_nvme\PEP 2019.3\Assets\PenseCre\Scripts\GraphSystem_ForEach.cs:line 57
 
 I am trying to set a simple and optimised pipeline for using dots to move a bunch of particles around following some simple maths formulas. It works in the editor (image below), but this error will not let it compile. 
 
  
 
 
 This code used to work a few months ago when I wrote it in Entities 0.0.12-preview.33 / Burst 1.1.2. But of course since then there has been many changes in the way to use the pipeline, and now when refactoring, I am stuck with this error. 
 
 That's what I have so far: 
 
 
 using Unity.Burst;
 using Unity.Collections;
 using Unity.Entities;
 using Unity.Jobs;
 using Unity.Mathematics;
 using Unity.Rendering;
 using Unity.Transforms;
 using static Unity.Mathematics.math;
 
 public delegate void Function(float u, float v, float t, ref float3 val);
 
 public class GraphSystem_ForEach : SystemBase
 {
     #region Declarations
     static readonly Function[] functions = {
         SineFunction, Sine2DFunction, MultiSineFunction, MultiSine2DFunction,
         Ripple, Cylinder, Sphere, Torus
     };
 
     const float PI = math.PI;
     const float E = math.E;
     const double PI_DBL = math.PI_DBL;
     const double E_DBL = math.E_DBL;
     #endregion
 
     protected override void OnUpdate()
     {
         float deltaTime = UnityEngine.Time.deltaTime;
         float time = UnityEngine.Time.time;
         float t = ((UnityEngine.Time.timeSinceLevelLoad % float.MaxValue) - Graph_ForEach.startTime) * Graph_ForEach.speed + Graph_ForEach.offset;
 
         int function = Graph_ForEach.function;
         //Function f = functions[Graph_ForEach.function]; //apparently I can't hold such variable here
         int resolution = Graph_ForEach.resolution;
         float step = 2f / Graph_ForEach.resolution;
         float2 inputPos = Graph_ForEach.inputPos;
 
         quaternion rot = new quaternion();
 
         Entities.ForEach((
             ref Translation translation,
             ref NonUniformScale scale,
             in Graph_ForEach graphComponent)
             =>
         {
             if (graphComponent.colliding == 0)
             {
                 float v = (graphComponent.id.x + 0.5f) * step - 1f;
                 float u = (graphComponent.id.y + 0.5f) * step - 1f;
 
                 functions[function](u, v, t, ref translation.Value);
 
                 ScaleFunction(ref translation.Value, ref scale.Value);
                 //scale.Value = ScaleFunction(translation.Value);
             }
         }).ScheduleParallel();
     }
 
     private static float ScaleFunction(float3 value)
     {
         return length(value) * Graph_ForEach.scaleMult + Graph_ForEach.scaleOffset;
     }
     static void ScaleFunction(float3 translation, ref float3 scale)
     {
         scale = length(translation) * Graph_ForEach.scaleMult + Graph_ForEach.scaleOffset;
     }
     static void ScaleFunction(ref float3 translation, ref float3 scale)
     {
         scale = length(translation) * Graph_ForEach.scaleMult + Graph_ForEach.scaleOffset;
     }
     #region Functions implementation (default from catlikecoding tutorial)
     static void FunctionTemplate(float x, float z, float t, ref float3 val)
     {
         float3 p;
         p.x = x;
         p.y = math.sin(PI * (x + t));
         p.z = z;
         val = p;
     }
 
     static void SineFunction(float x, float z, float t, ref float3 val)
     {
         float3 p;
         p.x = x;
         p.y = math.sin(PI * (x + t));
         p.z = z;
         val = p;
     }
 
     static void MultiSineFunction(float x, float z, float t, ref float3 val)
     {
         float3 p;
         p.x = x;
         p.y = math.sin(PI * (x + t));
         p.y += math.sin(2f * PI * (x + 2f * t)) / 2f;
         p.y *= 2f / 3f;
         p.z = z;
         val = p;
     }
 
     static void Sine2DFunction(float x, float z, float t, ref float3 val)
     {
         float3 p;
         p.x = x;
         p.y = math.sin(PI * (x + t));
         p.y += math.sin(PI * (z + t));
         p.y *= 0.5f;
         p.z = z;
         val = p;
     }
 
     static void MultiSine2DFunction(float x, float z, float t, ref float3 val)
     {
         float3 p;
         p.x = x;
         p.y = 4f * math.sin(PI * (x + z + t / 2f));
         p.y += math.sin(PI * (x + t));
         p.y += math.sin(2f * PI * (z + 2f * t)) * 0.5f;
         p.y *= 1f / 5.5f;
         p.z = z;
         val = p;
     }
 
     static void Ripple(float x, float z, float t, ref float3 val)
     {
         float3 p;
         float d = math.sqrt(x * x + z * z);
         p.x = x;
         p.y = math.sin(PI * (4f * d - t));
         p.y /= 1f + 10f * d;
         p.z = z;
         val = p;
     }
 
     static void Cylinder(float u, float v, float t, ref float3 val)
     {
         float3 p;
         float r = 0.8f + math.sin(PI * (6f * u + 2f * v + t)) * 0.2f;
         p.x = r * math.sin(PI * u);
         p.y = v;
         p.z = r * math.cos(PI * u);
         val = p;
     }
 
     static void Sphere(float u, float v, float t, ref float3 val)
     {
         float3 p;
         float r = 0.8f + math.sin(PI * (6f * u + t)) * 0.1f;
         r += math.sin(PI * (4f * v + t)) * 0.1f;
         float s = r * math.cos(PI * 0.5f * v);
         p.x = s * math.sin(PI * u);
         p.y = r * math.sin(PI * 0.5f * v);
         p.z = s * math.cos(PI * u);
         val = p;
     }
 
     static void Torus(float u, float v, float t, ref float3 val)
     {
         float3 p;
         float r1 = 0.65f + math.sin(PI * (6f * u + t)) * 0.1f;
         float r2 = 0.2f + math.sin(PI * (4f * v + t)) * 0.05f;
         float s = r2 * math.cos(PI * v) + r1;
         p.x = s * math.sin(PI * u);
         p.y = r2 * math.sin(PI * v);
         p.z = s * math.cos(PI * u);
         val = p;
     }
     #endregion
 }
 
 Any help much appreciated 
 
 Thanks in advance, 
 
 Stay safe 
 
 PS.: Sorry, copy/pasting with different line numbers in the forum post. Error points to line 57 in the editor, which is the line 51 here, where it says 
 functions[function](u, v, t, ref translation.Value); 
 
 
Your answer
 
 
             Follow this Question
Related Questions
Bizarre compile errors in Unity while Visual Studio will build project successfully 0 Answers
Multiple errors after updating asset package from store 0 Answers
Best loop for counting down a variable after an action 0 Answers
How to make the player can use flutter Jump like Yoshi in Super Mario World? 0 Answers
SpriteRender not loading sprites?,SpriteRender isn't changing the sprite 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                