I am trying to use onNofitication in BehaviorComponent to fire up my composed timeline actions. Which is formed up by one TransformTo action, one Hide action and followed by a Notification action indicating the other two actions are finished.
With this post, I successfully send a notification to RCP to fire up my timeline with identification:
NotificationCenter.default.post(
name: NSNotification.Name("RealityKit.NotificationTrigger"),
object: nil,
userInfo: [
"RealityKit.NotificationTrigger.Scene": scene,
"RealityKit.NotificationTrigger.Identifier": "onSomethingStart"
]
)
On the other hand, to subscribe that Notification Action, I append a onReceive function below my RealityView, and succesfully received my notification
private let notificationTrigger = NotificationCenter.default.publisher(
for: Notification.Name("RealityKit.NotificationTrigger"))
guard let entity = out.userInfo?["RealityKit.NotificationTrigger.SourceEntity"] as? Entity,
let notificationName = out.userInfo?["RealityKit.NotificationTrigger.Identifier"] as? String else { return }
debugPrint("Received notification: \(notificationName), entity name: \(entity.name)")
Which means that my Timeline is fired up because I can received my notification in my Timeline.
But the rest two actions just don't appear to be working. I played the timeline in RCP it works fine.
Anything I missed to make it tick?
XCode beta 16.1 VisionOS beta 9