onGameResize method

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

This passes the new size along to every component in the tree via their Component.onGameResize method, enabling each one to make their decision of how to handle the resize event.

It also updates the size field of the class to be used by later added components and other methods. You can override it further to add more custom behavior, but you should seriously consider calling the super implementation as well. This implementation also uses the current camera in order to transform the coordinate system appropriately.

Implementation

@override
void onGameResize(Vector2 size) {
  super.onGameResize(size);
  _updateVisibleCollisions();
  camera.onGameResize(size);
}