Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommend WithoutBurst() when Entity query contains code that would generate an error with Burst #101

Open
therealjohn opened this issue Jul 16, 2020 · 1 comment
Labels
help wanted Issues identified as good community contribution opportunities

Comments

@therealjohn
Copy link
Member

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();
@therealjohn 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
@sailro sailro added the help wanted Issues identified as good community contribution opportunities label Apr 26, 2021
@sailro
Copy link
Member

sailro commented Apr 26, 2021

Automatically adding "help wanted" tag for stale issues identified as good community contribution opportunities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

2 participants