onMount method
void
onMount()
inherited
Called when the component is added to its parent.
This method only runs when the component is fully loaded, i.e. after
onLoad
. However, onLoad
only ever runs once for the component, whereas
onMount
runs every time the component is inserted into the game tree.
This method runs when the component is about to be added to its parent.
At this point the parent
property already holds a reference to this
component's parent, however the parent doesn't have this component among
its children
yet.
After this method completes, the component is added to the parent's
children set, and then the flag isMounted
set to true.
Example:
@override
void onMount() {
position = parent!.size / 2;
}
See also:
onRemove
that is called every time the component is removed from the game tree
Implementation
void onMount() {}