It cannot be looped after enlarging the window.

I have developed a code that initiates the Timeline in the Reality Composer Pro scene every 12.93 seconds.

RealityView { … }
    .onAppear {
        startTimer()
    }
    .onDisappear {
        stopTimer()
    }
    func startTimer() {
        timer = Timer.scheduledTimer(withTimeInterval: 12.93, repeats: true) { _ in
            action()
        }
    }
    
    func stopTimer() {
        timer?.invalidate()
    }
    func action() {
        print(“SunUpDown”)
        NotificationCenter.default.post(
            name: NSNotification.Name(“RealityKit.NotificationTrigger”),
            object: nil,
            userInfo: [
                “RealityKit.NotificationTrigger.Scene”: scene as Any,
                “RealityKit.NotificationTrigger.Identifier”: “SunUpDown”
            ]
        )
    }

Upon receiving the “SunUpDown” command, Timeline will be executed.

However, everything was functioning normally when I was running the scene, and I could continue looping until I attempted to zoom in on the window and discovered that it ceased looping. Could you please provide an explanation for this behavior?

Note: The window type is volumetric, and the parameter of the defaultWorldScaling modifier is dynamic.

Answered by Vision Pro Engineer in 798835022

Hey @lijiaxu,

This sounds like a bug. I'm not seeing this behavior on Xcode 16 beta 4. Which version of Xcode are you using? Is “SunUpDown” printed to the console or after resizing is the timer becoming invalidated and the action method is no longer being called.

Thanks,

Michael

Accepted Answer

Hey @lijiaxu,

This sounds like a bug. I'm not seeing this behavior on Xcode 16 beta 4. Which version of Xcode are you using? Is “SunUpDown” printed to the console or after resizing is the timer becoming invalidated and the action method is no longer being called.

Thanks,

Michael

It cannot be looped after enlarging the window.
 
 
Q