So I have been working on a game using SpriteKit, utilizing the scene editor. Has been working very nicely, up until I was required to update to the latest SDK. I have been too busy lately and haven't gotten to work on it again until now... so it was flawless when I was running iOS 12 on my XS. My device is now iOS 13.3, which forced me to update to the latest version of Xcode (11.2?). Now, my app crashes, all textures from every SKSpriteNode in the scene are nil when getting references to them. They load just fine in the scene editor itself. In code, however, in the sceneDidLoad override, all of my childnode calls succeed in getting the SKSpriteNode reference, but texure is always nil... which then blows up my texture based PhysicsBody instansiations. The scenes entities structure also seems empty (so I'm not sure how I'm getting references to SKSpriteNodes, but I am). Just seems like GKScene fromFilename is loading an empty shell of my sks file.
This a known issue with the new tools? What did Apple change to break this? Anything new introduced that I need to be initializing? Should I be forced to update the project to Swift 5 to get rid of the issue? Not the first time Apple has changed something drastic in the application lifecycle that completely breaks every one of my apps, and I have to scrounge around for a different way to initialize the various components to get things to work again. Frankly I'm getting sick of it, spending more time fixing things from the complete disregard for any semblance of backwards compatibility in these SDKs than I do creating new functionality.
Thank you 🙂
Texture Alpha Masks are the issue.
You can find some discussion about the similar issue on StackOverflow:
- stackoverflow.com/questions/58544851/creating-a-physics-body-using-a-textures-alpha-channel-not-working-in-xcode-11
So, it is very likely your issue might be a bug of Xcode/iOS SDK.
that's likely going to require me to wait for iOS 13.3.1, or whatever, hotfix release
Apple would not fix it unless it is recognized as needs to be fixed. You should better send a bug report as soon as possible.
Before sending a bug report, you should better confirm:
- You use the latest Xcode, which is 11.3 released on December 10. Do not forget to restart your Mac after updating Xcode.
- Create a minimized project which reproduces the same issue, Apple may need the very sks file.
Unfortunately I could not have found any steady workaround on the Web.
One more, you should better post this on the more appropriate topic area: SpriteKit Graphics framework for 2D games