Skip to content

resolveRenderParent

resolveRenderParent(entity, layerName, tree): Container

Defined in: packages/renderer/src/SortGroupComponent.ts:63

Resolve the Pixi container a visual should render into: the nearest ancestor SortGroupComponent bound to the same layer, or the layer container itself when there is no enclosing group. Walks the entity hierarchy starting at entity (inclusive), so a visual on a group-owning entity joins that group.

The built-in visual components call this in their onAdd. A custom visual component (one implementing LayerRenderable) should do the same, so it joins an enclosing group on its initial add rather than only when the group next re-homes its subtree:

onAdd() {
const tree = this.use(SceneRenderTreeKey);
resolveRenderParent(this.entity, this.layerName, tree).addChild(
this.renderObject,
);
}

Entity

string

SceneRenderTree

Container