Add and Remove Component from Entity - reeseschultz/godex GitHub Wiki
You can add or remove Components directly from a System using the Storage<ComponentName>
.
/// Add the Winner component to the Red team
void my_system(Query<EntityID, RedTeam> &p_query, Storage<Winner> *p_winners_storage) {
for (auto [entity, red_team] : p_query) {
p_winners_storage->insert(entity, Winner());
}
}
However, when you don't know the exact component to add or remove when you write your system, you can use a Spawner