因此,我正在使用侧滚动器。 每个关卡都有一个带自定义玩家类的雪碧。 虽然确定精灵由其空闲动画设置的纹理,但我已在每个Level中应用纹理以供参考。添加纹理会导致崩溃...(未捕获的异常'NSInvalidArgumentException')
在它似乎做工精细
例如每个级别这是我的主要玩家猴子雪碧2级,因为它出现在大多数的水平。
然而,在两个层面上对这个球员雪碧的任何更改将导致游戏崩溃。 我不得不把它作为一个无纹理的精灵来做......任何一种改变都会导致游戏崩溃。例如,如果我添加一个新的纹理,我得到以下错误。
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid size specified: {6, -2.6005233764648423}'
*** First throw call stack:
(
0 CoreFoundation 0x00000001041a534b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010389e21e objc_exception_throw + 48
2 CoreFoundation 0x000000010420e265 +[NSException raise:format:] + 197
3 SpriteKit 0x0000000104d5060c -[SKSpriteNode initWithTexture:color:size:] + 204
4 SideScrolleriOS 0x00000001030248e5 _TFC15SideScrolleriOS8PlatformcfT7textureGSqCSo9SKTexture_5colorCSo7UIColor4sizeVSC6CGSize_S0_ + 661
5 SideScrolleriOS 0x00000001030785e6 _TFC15SideScrolleriOS14MovingPlatformcfT7textureGSqCSo9SKTexture_5colorCSo7UIColor4sizeVSC6CGSize_S0_ + 246
6 SideScrolleriOS 0x00000001030786e6 _TToFC15SideScrolleriOS14MovingPlatformcfT7textureGSqCSo9SKTexture_5colorCSo7UIColor4sizeVSC6CGSize_S0_ + 86
7 SpriteKit 0x0000000104d5157a -[SKSpriteNode initWithColor:size:] + 25
8 SideScrolleriOS 0x0000000103026ac4 _TTOFCSo12SKSpriteNodecfT5colorCSo7UIColor4sizeVSC6CGSize_S_ + 36
9 SideScrolleriOS 0x000000010301f440 _TFCSo12SKSpriteNodeCfT5colorCSo7UIColor4sizeVSC6CGSize_S_ + 96
10 SideScrolleriOS 0x000000010301e9c6 _TFC15SideScrolleriOS8Platform13setUpPlatformfCS_6PlayerT_ + 2166
11 SideScrolleriOS 0x0000000103077609 _TFC15SideScrolleriOS14MovingPlatform13setUpPlatformfCS_6PlayerT_ + 73
12 SideScrolleriOS 0x00000001030a9b0e _TFC15SideScrolleriOS9GameScene7didMovefT2toCSo6SKView_T_ + 12430
13 SideScrolleriOS 0x00000001030b6aaa _TToFC15SideScrolleriOS9GameScene7didMovefT2toCSo6SKView_T_ + 58
14 SpriteKit 0x0000000104d12c57 -[SKScene _didMoveToView:] + 198
15 SpriteKit 0x0000000104d3152e -[SKView presentScene:transition:] + 364
16 SideScrolleriOS 0x000000010309018d _TFC15SideScrolleriOS4Home8loadGamefT_T_ + 13805
17 SideScrolleriOS 0x000000010308cb1f _TFC15SideScrolleriOS4Home13pressedSelectfT_T_ + 4159
18 SideScrolleriOS 0x0000000103054cff _TFFC15SideScrolleriOS4Home12touchesBeganFTGVs3SetCSo7UITouch_4withGSqCSo7UIEvent__T_U_FTCSo6SKNodeGSpV10ObjectiveC8ObjCBool__T_ + 1375
19 SideScrolleriOS 0x0000000103043774 _TTRXFo_oCSo6SKNodedGSpV10ObjectiveC8ObjCBool___XFdCb_dS_dGSpS1____ + 68
20 SpriteKit 0x0000000104d4a946 -[SKNode _processSearchTokens:visited:usingBlock:stopPointer:] + 2729
21 SpriteKit 0x0000000104d4a083 -[SKNode _processSearchTokens:visited:usingBlock:stopPointer:] + 486
22 SpriteKit 0x0000000104d49d3a -[SKNode _enumerateChildNodesWithName:usingBlock:stopPointer:] + 1127
23 SpriteKit 0x0000000104d49612 -[SKNode enumerateChildNodesWithName:usingBlock:] + 58
24 SideScrolleriOS 0x0000000103054591 _TFC15SideScrolleriOS4Home12touchesBeganfTGVs3SetCSo7UITouch_4withGSqCSo7UIEvent__T_ + 737
25 SideScrolleriOS 0x0000000103054e96 _TToFC15SideScrolleriOS4Home12touchesBeganfTGVs3SetCSo7UITouch_4withGSqCSo7UIEvent__T_ + 102
26 SpriteKit 0x0000000104d2f6d6 -[SKView touchesBegan:withEvent:] + 1145
27 UIKit 0x0000000104feba21 -[UIWindow _sendTouchesForEvent:] + 2043
28 UIKit 0x0000000104fed3cf -[UIWindow sendEvent:] + 4011
29 UIKit 0x0000000104f9a63f -[UIApplication sendEvent:] + 371
30 UIKit 0x000000010578c71d __dispatchPreprocessedEventFromEventQueue + 3248
31 UIKit 0x00000001057853c7 __handleEventQueue + 4879
32 CoreFoundation 0x000000010414a311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
33 CoreFoundation 0x000000010412f59c __CFRunLoopDoSources0 + 556
34 CoreFoundation 0x000000010412ea86 __CFRunLoopRun + 918
35 CoreFoundation 0x000000010412e494 CFRunLoopRunSpecific + 420
36 GraphicsServices 0x0000000108cb4a6f GSEventRunModal + 161
37 UIKit 0x0000000104f7c964 UIApplicationMain + 159
38 SideScrolleriOS 0x0000000103109ecf main + 111
39 libdyld.dylib 0x000000010c7c568d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
我试着通过
- 修正错误复制我的2级和删除一切,但猴子雪碧和照相机(和它的孩子),然后从有问题的水平粘贴一切(除了无纹理的精灵和相机)。错误仍然发生。
这似乎没有发生,当我在Xcode 7中开发的东西,但切换到Swift 3和Xcode 8导致了一些奇怪的错误。
我试过这两个问题级别。我无法弄清楚。游戏构建工作正常,如果我只是让它保持不变。 我可以在场景编辑器中添加纹理。 但是,构建崩溃。
但是,将sprite纹理化以供编辑参考会有帮助。有人有主意吗?
您的纹理大小为6,-2.6 – Knight0fDragon
解决异常时,请注意“reason”后面的部分,如“无效大小指定:{6,-2.6005233764648423}'。你的纹理高度不能是-2。也许在这个类中有一些代码管理着计算纹理大小错误的级别。您还可以设置异常断点:http:// stackoverflow。COM /问题/ 17802662 /异常断点功能于Xcode的;并看看是否显示了问题可能来自哪条线。 –