You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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();
The text was updated successfully, but these errors were encountered:
therealjohn
changed the title
Recommend WithoutBurst() when Entity query contains code that would generate an error with Burst
Recommend WithoutBurst() when Entity query contains code that would generate an error with Burst
Jul 16, 2020
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'sOnUpdate()
method:Code like this will generate an error at runtime like:
Proposed solution
Modifying the code to this is an acceptable workaround if the user desires to use the singleton code as-is.
The text was updated successfully, but these errors were encountered: