---
title: PortalFactory
framework: realitykit
role: symbol
role_heading: Enumeration
path: realitykit/portalfactory
---

# PortalFactory

A factory for creating portal entities with simplified configuration.

## Declaration

```swift
enum PortalFactory
```

## Overview

Overview PortalFactory provides a convenient way to create complete portal setups by automatically configuring all necessary components including WorldComponent, ModelComponent with mesh and PortalMaterial, and PortalComponent with appropriate clipping and crossing modes. The factory returns a PortalSetup containing a root entity with both the portal and world entities as children. Simply add the root entity to your scene to display the portal. Example Usage Create a simple flat portal: let setup = PortalFactory.createPortal(     style: .plane(width: 2.0, height: 1.5) ) content.add(setup.rootEntity)

// Add content to the portal world let sphere = ModelEntity(mesh: .generateSphere(radius: 0.3), materials: [SimpleMaterial()]) setup.worldEntity.addChild(sphere)

## Topics

### Creating a portal

- [createPortal(style:enableClipping:enableCrossing:)](realitykit/portalfactory/createportal(style:enableclipping:enablecrossing:).md)
- [createPortal(world:portalEntity:style:enableClipping:enableCrossing:)](realitykit/portalfactory/createportal(world:portalentity:style:enableclipping:enablecrossing:).md)

### Configuring the portal

- [PortalFactory.Style](realitykit/portalfactory/style.md)
- [PortalFactory.PortalSetup](realitykit/portalfactory/portalsetup.md)

## See Also

### Portals, clipping, and occlusion

- [RenderLayerComponent](realitykit/renderlayercomponent.md)
- [RenderLayer](realitykit/renderlayer.md)
- [ClippingComponent](realitykit/clippingcomponent.md)
- [ClippingPrimitiveComponent](realitykit/clippingprimitivecomponent.md)
- [OcclusionCullingComponent](realitykit/occlusioncullingcomponent.md)
