I’m seeing odd Burst behavior with Entities 0.14 and Unity 2020.1.
The code below is a simple example of an IJobChunk, but I can’t seem to get it to Burst compile. It won’t show up in the Burst Inspector:
using Unity.Burst;
using Unity.Jobs;
using Unity.Entities;
namespace Sample
{
public class MySystem : SystemBase
{
EntityQuery query;
protected override void OnCreate()
{
query = GetEntityQuery(ComponentType.ReadWrite<Foo>());
}
protected override void OnUpdate()
{
Dependency = new ProcessChunks
{
FooTypeHandle = GetComponentTypeHandle<Foo>()
}.Schedule(query, Dependency);
}
[BurstCompile]
struct ProcessChunks : IJobChunk
{
public ComponentTypeHandle<Foo> FooTypeHandle;
public void Execute(ArchetypeChunk chunk, int chunkIndex, int entityOffset)
{
var testDataArray = chunk.GetNativeArray(FooTypeHandle);
testDataArray[0] = new Foo
{
value = 5
};
}
}
}
}
I feel like maybe I’m being dumb. Is there anything obvious I’m missing here, or should this IJobChunk be able to Burst compile?
And am I correct to think that if “Sample.MySystem.ProcessChunks” doesn’t appear in the Burst Inspector, that Burst isn’t compiling it?
Sincere thanks for any help.