priority property
Render priority of this component. This allows you to control the order in which your components are rendered.
Components are always updated and rendered in the order defined by what this number is when the component is added to the game. The smaller the priority, the sooner your component will be updated/rendered. It can be any integer (negative, zero, or positive). If two components share the same priority, they will probably be drawn in the order they were added.
Note that setting the priority is relatively expensive if the component is already added to a component tree since all siblings have to be re-added to the parent.
Implementation
@override
int get priority {
if (renderAboveComponents && hasGameRef) {
return LayerPriority.getAbovePriority(gameRef.highestPriority);
}
return LayerPriority.getComponentPriority(rectCollision.bottom.floor());
}
Implementation
set priority(int newPriority) {
if (_priority != newPriority) {
_priority = newPriority;
final game = findGame();
if (game != null && _parent != null) {
game.enqueueRebalance(_parent!);
}
}
}