So I'm working on a side scroller. Each level has a Sprite with a Custom Class of Player. While the texture that determines that sprite is set by it's idle animation, I've applied a texture in each Level for reference.
In each level it seems to work fine
E.g. Here's my level 2 with my main Player Monkey Sprite as it appears in most levels.
However, on two levels any changes to this Player Sprite causes the game to crash. I'm forced to leave the thing as an untextured sprite... any kind of change causes the game to crash. For instance if I add a new texture I get the following error.
E.g. Here it must be left untextured or I get a crash.
*** 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)
I've tried to fix the error by
- Duplicating my Level 2 and deleting everything but the Monkey Sprite and Camera (and it's children) , then pasting everything from the problematic level in (except the untextured sprite and it's camera). The error still occurs.
This didn't seem to happen when I was developing the thing in Xcode 7, but the switch to Swift 3 and Xcode 8 has caused some weird errors.
I've tried this for both the problem levels. I can't figure it out. The game build works fine if I just leave it untextured. I can add a texture in the scene editor. But, then the build crashes.
But, it'd be helpful to have the sprite textured for editing reference. Anyone have any ideas?