swift - 花栗鼠错误: Cannot remove a body that was not added to the space while changing scenes

标签 swift scene spritebuilder

我正在尝试使用 spritebuilder 在 Swift 中制作游戏。我可以从主场景更改场景,但是当我尝试从切换到的场景切换场景时,应用程序崩溃并出现以下错误:

由于花栗鼠错误而中止:无法删除未添加到空间中的主体。 (也许被删除了两次?)

我从不使用cpSpaceRemoveBody函数,并且在线程1中,remove被自动调用两次(我认为这就是问题所在)。

我正在使用以下方式切换场景:

let scene = CCBReader.loadAsScene("Gameover")
CCDirector.sharedDirector().presentScene(scene)

我一直在寻找,但找不到任何关于为什么会发生这种情况的信息。

最佳答案

嗯,这太尴尬了。我没有 onExit 方法。

关于swift - 花栗鼠错误: Cannot remove a body that was not added to the space while changing scenes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32620791/

相关文章:

android - Xcode 打不开 "Required content for Platform Android is missing"

ios - 如何在 iOS 中使用 takePicture() 以编程方式拍照?

c# - 统一: Are running Coroutines destroyed upon loading new scene?

ios - SpriteKit crossFadeWithDuration : between scenes not working as expected

cocos2d-iphone - iOS 应用验证错误 : Missing plist key CFBundleShortVersionString

ios - SpriteBuilder 不发布资源

ios - 调整谷歌地图 Swift 4 的大小

ios - 如何更改 UIAlertAction 的标题

swift - 为什么使用 NetFSMountURLSync 的命令行参数中的瑞典语字符不起作用?

javascript - 如何从 three.js 中的场景中删除所有 Mesh 对象?