You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TLDR: if you create a RectangleComponent, you cannot update it's size after first paint
classOffscreenCharacterextendsPositionComponentwithHasGameRef<MyGame> {
OffscreenCharacter();
/// REPRO: This paints at the correct size on first framelatefinal myRectangleComponent =RectangleComponent(
anchor:Anchor.center,
size: camera.gameSize,
paint:Paint()..color =Colors.red.withOpacity(0.2),
);
@overrideFuture<void>?onLoad() async {
awaitadd(myRectangleComponent);
returnsuper.onLoad();
}
latefinal camera = gameRef.camera;
@overridevoidonGameResize(Vector2 size) {
super.onGameResize(size);
/// REPRO: This is not able to update the size
myRectangleComponent.size.setFrom(gameRef.size);
}
@overridevoidupdate(double dt) {
final cameraCenter = camera.position + camera.gameSize /2;
myRectangleComponent.position.setFrom(cameraCenter);
super.update(dt);
}
}
TLDR: if you create a RectangleComponent, you cannot update it's size after first paint
Reproduction available here: https://github.com/lukepighetti/plt/tree/lukepighetti/on-game-resize-repro
Discord thread here: https://discord.com/channels/509714518008528896/1044629513000194138
The text was updated successfully, but these errors were encountered: