#Removing components
1 messages · Page 1 of 1 (latest)
What do you want to be the condition for removing the component?
event like keypress or mousepress or message from server or just certain amount of passed time
I was more interested in what the condition would be for a specific Text Component, How to differentiate the "hundreds of custom components"
Is it if text is "mytext" then Remove?
for example game item stats where each stat is different text component and i want them to appear/disappear in quick succession (like an animation)
Ah, do you want to spawn/despawn children of an entity?
is it structured something like this?
game_item_stats_card
-- title
-- stats_list
- stat1 (has a TextComponent)
- stat2 (has a TextComponent)
- stat3 (has a TextComponent)
If that is the case I would have a
#[derive(Component)]
struct StatsList(Vec<Entity>);
on the game_item_stats_card entity
then you can have a system that takes an event or something and a reference to the stats_list and then despawn them in the way that you want to.
But I'm sure that there are many ways to achieve this.