prepareComponent method

  1. @override
void prepareComponent(
  1. Component component
)

This method is called for every component before it is added to the component tree. It does preparation on a component before any update or render method is called on it.

You can use this to set up your mixins or pre-calculate things for example. By default, this calls the first onGameResize for every component, so don't forget to call super.prepareComponent when overriding.

Implementation

@override
void prepareComponent(Component component) {
  super.prepareComponent(component);
  if (component is Collidable) {
    collidables.add(component);
  }
}