简体   繁体   中英

SceneKit add floor crash

I edit in Scene Edit. first scene no problem(scene contain a floor). but when I use sceneView.present a new SCNScene(it contain only a foor) crash.

reason :

validateAttachmentOnDevice:313: failed assertion `MTLRenderPassDescriptor 
MTLStoreActionMultisampleResolve store action for the depth attachment is not 
supported by device'
func startGame() {
    let transition = SKTransition.doorsOpenVertical(withDuration: 1)
    sceneView.present(TestScene().scene, with: transition, incomingPointOfView: nil) {

    }
}
class TestScene : NSObject {
    var scene = Assets.scene(named: "scene_2.scn")
    override init() {
       super.init()
   }
}

场景编辑崩溃原因

Agreed that this is a SceneKit iOS 11 issue -- and I don't recall seeing this on my iPad on pre-iOS 11 builds.

Note that this does NOT seem to be an issue with iPhones, only iPads (possibly just iPad Air 2 - as that's the only physical iPad device I own).

I've been able to confirm that present:with does not work with real iPads (as opposed to the simulator) in certain scenarios. I haven't completely figured out the specific scenarios (maybe it's only when you add a floor to your scene).

The solution I recommend is not to use present:with (maybe use camera / lighting to simulate a transition, that's what I'm doing to do a "fade in" transition). You don't need to use a present:with transition to present your scene.

For example, if you start with the original Apple SceneKit template it works. Plus, you can add the following code, and it still works. But then add a floor, and it fails.

Add a present:with (add this directly after scnView.scene = scene)

let sceneTransition = SKTransition.fade(withDuration: 4.0)
scnView.present(scene,
                with: sceneTransition,
                incomingPointOfView: nil,
                completionHandler: nil)

Note: you'll have to add "import SpriteKit" at the top of the file to support SKTransition. This transition code does NOT fail on my iPad Air 2 without a "floor" element in "ship.scn" (although it doesn't seem to do anything).

But when you drag an empty "floor" element to the "ship.scn" scene, and rerun, then it fails with the error you noted above. 添加了地板的 SceneKit 模板

Then, comment out the present:with code, and it works again.

Side note that this does not fail on a simulator , but it does fail on my device. I've got my iPad Air 2 updated to latest iOS (11.1) and Deployment Target set to same.

Also, the present:with does work on my iPhone 6s with iOS 11.1. So this seems to be only an iPad issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM