| 1 |
--- |
| 2 |
title: "Exclusive function systems have been unified with regular function systems" |
| 3 |
pull_requests: [25507] |
| 4 |
--- |
| 5 |
|
| 6 |
`ExclusiveFunctionSystem`, `ExclusiveSystemParam`, and `ExclusiveSystemParamFunction` |
| 7 |
have been removed. Exclusive function systems now use the same code path as |
| 8 |
regular function systems: `FunctionSystem`, `SystemParam`, and `SystemParamFunction`. |
| 9 |
|
| 10 |
`&mut World` now implements `SystemParam`, which means it is no longer required |
| 11 |
to be the first parameter of a function system. Instead, it may appear anywhere |
| 12 |
in the parameter list, so long as it does not conflict with other system parameters |
| 13 |
(same as before). Generally speaking, this means systems' "exclusivity" is now |
| 14 |
tracked at runtime, rather than compile time. |
| 15 |
|
| 16 |
All `ExclusiveSystemParam`s that did not previously implement `SystemParam` now |
| 17 |
implement it, including `&mut QueryState` and `&mut SystemState`. |
| 18 |
|
| 19 |
It is no longer possible to use `WorldId` in an exclusive system, |
| 20 |
since the `SystemParam` implementation needs to read it from the `World`. |
| 21 |
If you were using `WorldId` in an exclusive system, |
| 22 |
consider calling `World::id()` as the first line of the system. |
| 23 |
Alternately, use `Local<WorldId>` as a parameter, |
| 24 |
which will be automatically populated with the correct ID. |
| 25 |
|
| 26 |
`System::is_exclusive()` has been removed. Use `SystemAccess::is_exclusive()` instead, |
| 27 |
which is created by `System::initialize()` and stored in `SystemWithAccess`. |
| 28 |
|
| 29 |
`System::initialize()` now returns a `SystemAccess` rather than a `FilteredAccessSet`. |
| 30 |
`SystemAccess` is a superset of `FilteredAccessSet` that also tracks whether the |
| 31 |
system is exclusive, or requires no access to the world at all. If you require |
| 32 |
access to a `FilteredAccessSet`, call `SystemAccess::require_shared_access(system_meta)`. |
| 33 |
|
| 34 |
`ExclusiveMarker` has been removed. If you need to mark a system as exclusive, |
| 35 |
consider piping the system into a `fn(&mut World)` system, which will automatically |
| 36 |
mark it as exclusive. |