Fixing addLater component lifecycle

This commit is contained in:
Erick Zanardo
2020-04-05 12:17:21 -03:00
parent 6c97849256
commit f1e7cc9bff
2 changed files with 2 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
## [next] ## [next]
- Fixing component lifecycle calls on Component#addLater
## 0.18.3 ## 0.18.3
- Adding Component#onDestroy - Adding Component#onDestroy

View File

@@ -229,7 +229,7 @@ abstract class BaseGame extends Game with TapDetector {
/// You can override it further to add more custom behaviour. /// You can override it further to add more custom behaviour.
@override @override
void update(double t) { void update(double t) {
components.addAll(_addLater); _addLater.forEach(add);
_addLater.clear(); _addLater.clear();
components.forEach((c) => c.update(t)); components.forEach((c) => c.update(t));