Search code examples
swiftaugmented-realityrealitykitreality-composer

File from Reality Composer not switching scenes on iPhone 7


I've created multi-scene files in Reality Composer. They work fine within that software, but when I export them out to a reality file, load them onto my iPhone 7, and then run them, the interactive behaviors are working, but when I click on a button to change scenes, nothing happens.

Is this a known bug, or a feature not implemented yet?


Solution

  • It's not a bug. Seemingly you do not append anchor holding B scene to an array of anchors, while removing previous anchor containing A scene.

    You can read this post (a second approach) to find out how to implement a desired methodology.

    @IBAction func tappedButton(_ sender: UITapGestureRecognizer) {
    
        if (counter % 2) == 0 {
            arView.scene.anchors.removeAll()
            arView.scene.anchors.append(firstSceneAnchor!)
        } else {
            arView.scene.anchors.removeAll()
            arView.scene.anchors.append(secondSceneAnchor!)
        }
        counter += 1
    }