bevy_cobweb_ui 0.22.2

UI framework for the bevy game engine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use bevy::prelude::*;
use bevy_cobweb::prelude::*;

//-------------------------------------------------------------------------------------------------------------------

/// Despawns the `token`'s reactor when `entity` is despawned.
pub fn cleanup_reactor_on_despawn(c: &mut Commands, entity: Entity, token: RevokeToken)
{
    c.react().on(despawn(entity), move |mut c: Commands| {
        c.react().revoke(token.clone());
    });
}

//-------------------------------------------------------------------------------------------------------------------