onGameResize method

  1. @override
void onGameResize(
  1. Vector2 canvasSize
)
override

Called whenever the size of the top-level Canvas changes.

In addition, this method will be invoked once after the component is attached to the game tree, and before onLoad is called.

Implementation

@override
void onGameResize(Vector2 canvasSize) {
  super.onGameResize(canvasSize);
  position = canvasSize / 2;
  size = canvasSize;
}