Recommend WithoutBurst() when Entity query contains code that would generate an error with Burst
Problem statement
With the new Entity Component System (ECS), users can write code that is not compatible with the Burst compiler and it causes a runtime error.
The user needs to change their code to be Burst compatible, but if that's not possible or desirable, the WithoutBurst() method is recommended to exclude the code from Burst compilation.
Consider code like this in a SystemBase subclass's OnUpdate() method:
Entities.ForEach((ref Translation translation) =>
{
var speed = Test.instance.speed; // reads a value from a static singleton class
// Do something with speed
).Run();
Code like this will generate an error at runtime like:
Burst error BC1016: The managed function
MyProject.Test.get_instance()is not supported.
Proposed solution
Modifying the code to this is an acceptable workaround if the user desires to use the singleton code as-is.
Entities.ForEach((ref Translation translation) =>
{
var speed = Test.instance.speed; // reads a value from a static singleton class
// Do something with speed
).WithoutBurst().Run();
Automatically adding "help wanted" tag for stale issues identified as good community contribution opportunities