init
TypeScriptstatic init(): PortalCrossingComponentSwift declarationinit()struct · iOS 18.0+ · SDK 27.1
struct PortalCrossingComponentA component that allows entities to cross portal boundaries. Set this component on an entity inside the portal world to opt that entity — and its descendants — into the portal's crossing behavior. RealityKit then renders parts of the entity inside the portal as portal content and parts outside in the host scene. Crossing-eligible entities cross the boundary configured by ``PortalComponent/crossingMode-swift.property`` on the portal entity: - With ``PortalComponent/CrossingMode-swift.enum/plane(_:)``, entities cross an infinite plane. - With ``PortalComponent/CrossingMode-swift.enum/volume(_:)``, entities cross the faces of a box. The component has no configurable state; its presence on an entity is what enables crossing. ### Inheritance ``PortalCrossingComponent`` propagates down the entity hierarchy. Setting it on an ancestor makes every descendant crossing-eligible without setting it on each one individually: ```swift let world = Entity() world.components.set(WorldComponent()) let group = Entity() group.components.set(PortalCrossingComponent()) let body = Entity() let head = Entity() group.addChild(body) group.addChild(head) world.addChild(group) // `body` and `head` both cross the portal because their ancestor `group` opts in. ``` An entity isn't crossing-eligible if no ancestor in its chain (including itself) has ``PortalCrossingComponent``, if ``Entity/isEnabled`` is `false` on any ancestor in the chain, or if it isn't a descendant of an entity with ``WorldComponent``. See ``PortalComponent`` for an end-to-end portal setup.
static init(): PortalCrossingComponentSwift declarationinit()No declarations were skipped in this snapshot.