We seen to have found an issue when using the pushWindow action on visionOS. The issue occurs if the app is backgrounded then reopened by selecting the apps icon on the home screen. Any window that is opened via the pushWindow action is then dismissed. We've been able to replicate the issue in a small sample project.
Replication steps
Open app
Open window via the push action
Press the digital crown
On the home screen select the apps icon again
The pushed window will now be dismissed.
There is a sample project linked here that shows off the issue, including a video of the bug in progress
Post
Replies
Boosts
Views
Activity
I seem to be running into an issue in an app I am working on were I am unable to update the IBL for entity more than once in a RealityKit scene. The app is being developed for visionOS.
I have a scene with a model the user interacts with and 360 panoramas as a skybox. These skyboxes can change based on user interaction. I have created an IBL for each of the skyboxes and was intending to swap out the ImageBasedLightComponent and ImageBasedLightReceiverComponent components when updating the skybox in the RealityView's update closure.
The first update works as expected but updating the components after that has no effect. Not sure if this is intended or if I'm just holding it wrong. Would really appreciate any guidance. Thanks
Simplified example
// Task spun up from update closure in RealityView
Task {
if let information = currentSkybox.iblInformation, let resource = try? await EnvironmentResource(named: information.name) {
parentEntity.components.remove(ImageBasedLightReceiverComponent.self)
if let iblEntity = content.entities.first(where: { $0.name == "ibl" }) {
content.remove(iblEntity)
}
let newIBLEntity = Entity()
var iblComponent = ImageBasedLightComponent(source: .single(resource))
iblComponent.inheritsRotation = true
iblComponent.intensityExponent = information.intensity
newIBLEntity.transform.rotation = .init(angle: currentPanorama.rotation, axis: [0, 1, 0])
newIBLEntity.components.set(iblComponent)
newIBLEntity.name = "ibl"
content.add(newIBLEntity)
parentEntity.components.set([
ImageBasedLightReceiverComponent(imageBasedLight: newIBLEntity),
EnvironmentLightingConfigurationComponent(environmentLightingWeight: 0),
])
} else {
parentEntity.components.remove(ImageBasedLightReceiverComponent.self)
}
}
We appear to be experiencing a bug with the latest beta for visionOS, we are attempting to playback a video with a transparent background in the app. In the previous beta playback worked as expected and the transparent parts of the video were transparent. In the latest beta the background appears black. The view we are using in a SwiftUI wrapped version of AVPlayerViewController, we have narrowed the bug down to only occurring only when playback is being presented in the embedded experience mode, if playback is being done in the expanded experience then playback is as expected.
This has only only been visible on an actual device, we have been unable to replicate the behaviour in the simulator using the latest Xcode 16.0 beta(beta 5 (16A5221g))
This is sample project that shows off the bug
I am working on an app where we are attempting to place large entities quite far away from the user, when trying to recognise a tap gesture on them though the gesture isn't being picked up for part of the model.
It seems as though the larger and further a model is placed the more offset the collision shape seems to be. It responds to taps in a region that shrinks towards the bottom right. The actual size of the collision shape appears to be correct when viewed with the collision shape debug visualisation. I've been able to replicate this behaviour in the simulator and on a physical device.
It's hard to explain in words, there's a video in the README for the repo here
I've been able to replicate the issue in a simple sample app. Not sure if I might be using it wrong or if it is expected behaviour for tap gestures to be a bit off when places a large distance from the user. Appreciate any help, thanks.
struct ImmersiveView: View {
@State private var tapCount = 0
var body: some View {
RealityView { content in
let sphere = ModelEntity(mesh: .generateSphere(radius: 50), materials: [UnlitMaterial(color: .red)])
sphere.setPosition([500, 0, 0], relativeTo: nil)
sphere.components.set([
InputTargetComponent(),
CollisionComponent(shapes: [.generateBox(width: 250, height: 250, depth: 250)]),
])
content.add(sphere)
}
.gesture(
SpatialTapGesture()
.targetedToAnyEntity()
.onEnded { value in
tapCount += 1
print(tapCount)
}
)
}
}
``
I seem to be running into an issue where the .glassBackgroundEffect modifier doesn't seem to render correctly. The issue is occurring when attached to a view shown in a RealityKit immersive view with a Skybox texture. The glass effect is applied but doesn't let any of the colour of the skybox behind it though.
I have created a sample project which is just the immersive space template with the addition of a skybox texture and an attachment with the glassBackgroundEffect modifier. The RealityView itself is
struct ImmersiveView: View {
var body: some View {
RealityView { content, attachments in
// Add the initial RealityKit content
if let immersiveContentEntity = try? await Entity(named: "Immersive", in: realityKitContentBundle) {
content.add(immersiveContentEntity)
let attachment = attachments.entity(for: "foo")!
let leftSphere = immersiveContentEntity.findEntity(named: "Sphere_Left")!
attachment.position = [0, 0.2, 0]
leftSphere.addChild(attachment)
// Add an ImageBasedLight for the immersive content
guard let resource = try? await EnvironmentResource(named: "ImageBasedLight") else { return }
let iblComponent = ImageBasedLightComponent(source: .single(resource), intensityExponent: 0.25)
immersiveContentEntity.components.set(iblComponent)
immersiveContentEntity.components.set(ImageBasedLightReceiverComponent(imageBasedLight: immersiveContentEntity))
// Put skybox here. See example in World project available at
var skyboxMaterial = UnlitMaterial()
let skyboxTexture = try! await TextureResource(named: "pano")
skyboxMaterial.color = .init(texture: .init(skyboxTexture))
let skyboxEntity = Entity()
skyboxEntity.components.set(ModelComponent(mesh: .generateSphere(radius: 1000), materials: [skyboxMaterial]))
skyboxEntity.scale *= .init(x: -1, y: 1, z: 1)
content.add(skyboxEntity)
}
} update: { _, _ in
} attachments: {
Attachment(id: "foo") {
Text("Hello")
.font(.extraLargeTitle)
.padding(48)
.glassBackgroundEffect()
}
}
}
}
The effect is shown bellow
I've tried this both in the simulator and in a physical device and get the same behaviour.
Not sure if this is an issue with RealityKit or if I'm just holding it wrong, would greatly appreciate any help. Thanks.