-
|
There's little information I can find on scheduling after 0.10, so I don't know whether I must use direct world access. Currently I'm using state to mark processing states: #[derive(States, Debug, Clone, PartialEq, Eq, Hash)]
pub enum ProcessState {
None,
LoadScene,
PostLoadScene,
SaveScene,
PreEnterPlay,
}They mark different stages of processing, and note that this process may be done multiple times when player intends. For different stages, I use |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
|
Are you shure the |
Beta Was this translation helpful? Give feedback.
-
|
Have a look to : https://bevyengine.org/learn/errors/b0002/, it might help you to find where you use an immutable and a mutable access to a Resource (maybe you use a |
Beta Was this translation helpful? Give feedback.
-
|
It seems when there's |
Beta Was this translation helpful? Give feedback.
-
|
I turned to (
process_loaded_scene,
|mut next_state: ResMut<NextState<ProcessState>>| {
next_state.set(ProcessState::PreEnterGame);
},
)
.chain()and it works. |
Beta Was this translation helpful? Give feedback.
-
|
The problem comes from the fact the
So you break the Rust rules on references (either one mutable reference or any number of immutable references) on a resource. The question is why do you need an acces to the whole So, out of curiosity, which |
Beta Was this translation helpful? Give feedback.
The problem comes from the fact the
world: &World, mut commands: Commands, mut next_state: ResMut<NextState<ProcessState>>,system params :world: &Worldimplies a read only lock to the whole worldmut next_state: ResMut<NextState<ProcessState>>implies a exclusive write access to theNextState<ProcessState>resource, which is part of the worldSo you break the Rust rules on references (either one mutable reference or any number of immutable references) on a resource.
The question is why do you need an acces to the whole
Worldinstead of usingQuery<>orRes<>system params ? An access to&Worldwill block all other systems that need an mutable acces to a part of the world to run in par…