Lab 102 – Input works with Portals in Immersive Spaces
A follow up to lab 093, where input was not working when using portals in a window. Input does work when using the same portal scene in an immersive space.
Check out the video to compare the same portal scene presented in a window and in an immersive space. Input fails silently on the entities inside the window, but works as expected on the entities in the immersive space.
Video demo showing input working on an entity inside a portal when the portal is presented in an immersive space
Lab Code
struct Lab102: View {
@State var rootEntity = Entity()
@State var portalEntity = ModelEntity(
mesh: .generatePlane(width: 1.0, height: 2.0, cornerRadius: 0.05),
materials: [PortalMaterial()]
)
var body: some View {
RealityView { content in
content.add(rootEntity)
let portalContentRoot = Entity()
portalContentRoot.components.set(WorldComponent())
rootEntity.addChild(portalContentRoot)
portalEntity.position = .init(x: 0, y: 1, z: -2.1)
portalEntity.components.set(PortalComponent(target: portalContentRoot))
rootEntity.addChild(portalEntity)
guard let scene = try? await Entity(named: "TeleportLabs", in: realityKitContentBundle) else { return }
portalContentRoot.addChild(scene)
// Adding Manipulation to the Green Sphere
if let subject = scene.findEntity(named: "StepSphereGreen") {
subject.components.set(ManipulationComponent())
}
}
}
}Support our work so we can continue to bring you new examples and articles.
Download the Xcode project with this and many more labs from Step Into Vision.

Follow Step Into Vision