onRemove method
Called right before the component is removed from the game.
Implementation
@override
void onRemove() {
final parentGame = findParent<FlameGame>();
if (parentGame is HasCollidables) {
parentGame.collidables.remove(this);
}
super.onRemove();
}