我試圖從一個SKS文件裝載SKEmitterNode,我不斷收到此錯誤:SKEmitterNode崩潰
Terminating app due to uncaught exception
'NSInvalidUnarchiveOperationException',
reason: '*** -[NSKeyedUnarchiver decodeObjectForKey:]:
cannot decode object of class (SKEditorScene)'
代碼:
var explosion = SKEmitterNode.emitterNodeWithName("Explosion")
retval.addChild(explosion)
ExtensionMethod:
class func emitterNodeWithName(name: String) -> SKEmitterNode
{
return NSKeyedUnarchiver.unarchiveObjectWithFile(NSBundle.mainBundle().pathForResource(name, ofType: "sks")!) as SKEmitterNode
}
任何想法?
這是由於XCode將.sks文件視爲場景並破壞它的錯誤。它在XCode 6.1 Beta中修復了 – 2014-09-25 04:03:16