RealityKit Crash with Orthographic Camera

In macOS project with RealityKit and SwiftUI, adding OrthographicCameraComponent causes crashes in both Xcode Preview and at runtime.

import SwiftUI
import RealityKit

struct ContentView: View {

    var body: some View {
        RealityView { content in
            var camera = Entity()
            var component = OrthographicCameraComponent()
            
            component.scale = 5
            camera.position = [0, 0, 5]
            
            camera.components.set(component)
            
            content.add(camera)
            content.add(ModelEntity(mesh: .generateSphere(radius: 1)))
        }
    }
}

#Preview {
    ContentView()
}

Has anyone faced this issue or knows a fix?

Hi, can you share a crash report?

Thank you, can you see if this issue is fixed in .2 beta releases (macOS 15.2, iOS 18.2, visionOS 2.2)? I believe this should be fixed in those updates.

RealityKit Crash with Orthographic Camera
 
 
Q