Guest User

Update Functions

a guest
Jun 30th, 2025
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.86 KB | None | 0 0
  1. pub fn hide_non_current_scene_entities(
  2.     current_scenes: ResMut<CurrentGameScenes>,
  3.     mut q_scenes: Query<(Entity, &InGameScene, &mut Visibility)>
  4. ) {
  5.     for (entity, in_scene, mut visibility) in q_scenes.iter_mut() {
  6.         if current_scenes.0.contains(&in_scene.0) {
  7.             continue;
  8.         }
  9.  
  10.         info!("hid entity {}", entity);
  11.  
  12.         *visibility = Visibility::Hidden;
  13.     }
  14. }
  15.  
  16. pub fn show_current_scene_entities(
  17.     current_scenes: ResMut<CurrentGameScenes>,
  18.     mut q_scenes: Query<(Entity, &InGameScene, &mut Visibility), (With<Disabled>, With<DisabledByVisibility>)>
  19. ) {
  20.     for (entity, in_scene, mut visibility) in q_scenes.iter_mut() {
  21.         if !current_scenes.0.contains(&in_scene.0) {
  22.             continue;
  23.         }
  24.  
  25.         info!("unhid entity {}", entity);
  26.  
  27.         *visibility = Visibility::Inherited
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment