Clarification on SystemBase and BurstCompiler

Hi everyone.
I’ve been using the SystemBase lately, and I wanted to know if there was anything special I needed to do in order for it to be BurstCompiled.

AFAIK that comes automatically on SystemBase (without the need of adding the BurstCompile attribute), but I also noticed there was this method

Entities.WithBurst()

So I wanted to know if I have to explicitly call this in order for my code to be burst compiled
i.e

Entities.WithBurst().ForEach((Entity entity, int nativeThreadIndex, ref SomeReferencedData refData, in InputData inData) => {

// System Logic

}).ScheduleParallel();

or if just something like:

Entities.ForEach((Entity entity, int nativeThreadIndex, ref SomeReferencedData refData, in InputData inData) => {

// System Logic

}).ScheduleParallel();

would be enough for it to be burst compiled as well.

Thanks!
.

WithBurst allows you to specify a few more arguments regarding burst, but Entities.ForEach is implicitly bursted.

4 Likes