I am working with RealityKit in Vision OS beta 1 and can't build the light source. I want to use that light source in the fully immersive space (that has no light source by default). I tried that code to create the entity with the SpotLightComponent. I got the error 'SpotLightComponent' is unavailable in visionOS.
SpotLightComponent.registerComponent()
let entity = Entity()
let lightComponent = SpotLightComponent(
color: .white,
intensity: 6740.94,
innerAngleInDegrees: 45.0,
outerAngleInDegrees: 60.0,
attenuationRadius: 10.0
)
entity.components.set(lightComponent)
I build that code in the swift package limited to only visionOS platform, and from the app itself. No luck.
platforms: [
.visionOS(.v1)
],
I expected the code to be able to build at least because the Apple docs have this component listed as available. https://developer.apple.com/documentation/realitykit/spotlightcomponent