The main version of the Xcode 7 Sprite Kit Atlas Bug

So, today I decided to start testing my game on El Capitan and iOS 9. This is a big project that I have been working on in my free time for almost 2 years. Therefore, I transfer my code to Swift 2.0, press the start button and pray that Apple does not violate the Sprite Kit (as it was in the past: one , two , three , four, and don’t even start with the node form ...). So, my game starts up, and what do you know - all my nodes are incorrectly located, as well as my animated textures. Some other minor errors, such as counting runs, are not displayed, but they are small, and I hope they will also be fixed.

So, I start debugging, and eventually I can find that most of the problem is due to the fact that the nodes in my atlases are not correctly positioned. Therefore, I created a sample project, as shown below, using only one node. You can see in the picture that I set the anchor point of the nodes (0,0) and position (0,0). The anchor point of the scene is also (0,0). I printed all of these values ​​to make sure they are correct.

enter image description here

You can also see that it is drawn correctly in the editor. However, when I launch the game, I get the following:

enter image description here

You can see that the node does not display correctly. Its position is (0,0), but it is offset. And my scene does not scale, it matches the size of the view and is set to ResizeFill.

I get this problem on both El Capitan and iOS 9. Interestingly, the problem becomes more noticeable the more the image contains transparent pixels. As you can see from the screenshot of the editor, my image contains a lot of transparent pixels, because I wanted to clearly show the error. If I used less transparent pixels, node would be less than offset.

If I do not use the atlas, then the node is drawn correctly, as shown below. However, I obviously want to use atlases so that I can render my nodes.

enter image description here

I registered this error on Radar. Has anyone found a workaround for this problem that is not related to using atlases?

+5
ios ios9 xcode7 sprite-kit macos
source share
1 answer

I found a workaround for this as I asked a question. Hope this helps other people facing the problem. And, hopefully, Apple corrects this major bug before the final version.

If you use the new atlases XCAssets AND , you set the deployment target to the latest version, node is processed correctly. So, all you have to do is move all your atlases to XCAssets. This effect is backward compatible with iOS 8 / Yosemite.

enter image description here

0
source share

All Articles