Skip to main content

bind_portals

Function bind_portals 

Source
pub fn bind_portals(
    targets: ResMut<'_, RenderTargets>,
    placeholder: Res<'_, PortalPlaceholder>,
    portals: Query<'_, '_, (Entity, &RPortal, &mut ImageNode)>,
)
Expand description

Point every <portal>’s ImageNode at the texture for its target name (or the placeholder when the name isn’t registered), and record the portal as the target’s binder for Resolution::Auto sizing. Only writes image when it actually changes, so it doesn’t needlessly re-extract the node every frame.

This is what decouples ordering: a portal may mount before its target exists and rebinds the instant it appears (and reverts to the placeholder on remove).