<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/PortalComponent/configure(world:portalEntity:surfaceStyle:boundaryStyle:boundaryMode:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation15PortalComponentV9configure5world12portalEntity12surfaceStyle08boundaryJ00K4ModeyAA0H0C_AkC07SurfaceJ0VAC08BoundaryJ0VAC0nL0OtFZ"
  },
  "title" : "configure(world:portalEntity:surfaceStyle:boundaryStyle:boundaryMode:)"
}
-->

# configure(world:portalEntity:surfaceStyle:boundaryStyle:boundaryMode:)

Configures an existing pair of entities as a portal and its target world.

```
static func configure(world: Entity, portalEntity: Entity, surfaceStyle: PortalComponent.SurfaceStyle, boundaryStyle: PortalComponent.BoundaryStyle = .infinitePlane(), boundaryMode: PortalComponent.BoundaryMode = .none)
```

## Parameters

`world`

The entity that contains the portal’s content. Place portal world descendants
under this entity.

`portalEntity`

The entity that displays the portal surface in the host scene.

`surfaceStyle`

The size of the portal surface mesh.

`boundaryStyle`

The shape of the clipping and crossing boundary. Defaults to
[`infinitePlane()`](/documentation/RealityKit/PortalComponent/BoundaryStyle/infinitePlane()).

`boundaryMode`

The combination of clipping and crossing behaviors to enable. Defaults
to [`PortalComponent.BoundaryMode.none`](/documentation/RealityKit/PortalComponent/BoundaryMode/none).

## Discussion

This method writes a coordinated set of components onto the two entities you provide. Use it
when you already own both entities — for example, when the portal entity holds gestures or
other components, or when the world entity is a child of an existing scene.

On the world entity, this method sets:

- [`WorldComponent`](/documentation/RealityKit/WorldComponent)

On the portal entity, this method sets:

- [`ModelComponent`](/documentation/RealityKit/ModelComponent) with a flat plane mesh sized by `surfaceStyle`, applied with [`PortalMaterial`](/documentation/RealityKit/PortalMaterial)
- [`PortalComponent`](/documentation/RealityKit/PortalComponent) with [`clippingMode`](/documentation/RealityKit/PortalComponent/clippingMode-swift.property) and
  [`crossingMode`](/documentation/RealityKit/PortalComponent/crossingMode-swift.property) configured from `boundaryStyle` and `boundaryMode`

This method replaces any existing [`WorldComponent`](/documentation/RealityKit/WorldComponent), [`ModelComponent`](/documentation/RealityKit/ModelComponent), or
[`PortalComponent`](/documentation/RealityKit/PortalComponent) on the entities. Other components on either entity are preserved.

To create both entities at once, use
[`makePortal(surfaceStyle:boundaryStyle:boundaryMode:)`](/documentation/RealityKit/PortalComponent/makePortal(surfaceStyle:boundaryStyle:boundaryMode:)) instead.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)