Replies: 1 comment
-
Ideally, only use exclusive world access when you need it. By using system parameters to get the resources and queries you need, you allow the system to run at the same time as other systems that only want to access other things. Allows Bevy's scheduler to do it's job and multithread everything it can. The difference you asked about would be when you add it as a command, it gets run the next time the command queue is applied instead of while that system is processed. This may or may not be what you want, sometimes you need the result of what you are doing immediately before other systems run. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there any sense in writing something like this:
I started with a system that accessed commands and other resources, and then realized I could turn the resource parameters into resource accesses from the world directly in commands. After that, I realized that my whole system structure was essentially the code above, and could probably be replaced with an exclusive system. However, as I understand it, exclusive systems also create hard sync points in the schedule, and I wanted to avoid creating another when commands will simply run at the next hard sync point. On the other hand... I'm not adding any explicit ordering constraints to this system, so will it just run at or near another hard sync point, for example at the end of the base set it's in, or another exclusive system in a plugin I've added?
In summary, is there any real difference between my code above and an exclusive system? If not, is one always preferable, or are there simply nuances to be aware of?
Beta Was this translation helpful? Give feedback.
All reactions