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
I think it is common to spawn some entities in startup systems and then assume that they get spawned before other systems are spawned.
Following example:
use bevy::prelude::*;use spew::prelude::*;#[derive(Debug,PartialEq,Eq)]enumObjects{Player,}fnmain(){App::new().add_plugin(SpewPlugin::<Objects,()>::default()).add_spawner((Objects::Player, spawn_player)).add_system(player_state).add_startup_system(setup).run();}#[derive(Component)]structPlayerMarker;fnspawn_player(world:&mutWorld,_input:()){
world.spawn(PlayerMarker);}fnsetup(mutspawn_events:EventWriter<SpawnEvent<Objects,()>>){
spawn_events.send(SpawnEvent{object:Objects::Player,data:(),});}fnplayer_state(player:Query<&PlayerLabel>){let _player_label = player.single();}
This would crash since the event would only be processed after the first frame
since the event will first be processed in the first frame and entity spawns are only processed in the last stage (I think) .
It would be nice to have some kind of new CoreSet which checks if any startup system send spawn events and already spawns them accordingly before the normal systems begin to run
The text was updated successfully, but these errors were encountered:
I think it is common to spawn some entities in startup systems and then assume that they get spawned before other systems are spawned.
Following example:
This would crash since the event would only be processed after the first frame
since the event will first be processed in the first frame and entity spawns are only processed in the last stage (I think) .
It would be nice to have some kind of new
CoreSet
which checks if any startup system send spawn events and already spawns them accordingly before the normal systems begin to runThe text was updated successfully, but these errors were encountered: