I'm testing a game on the OS X version of Sprite Kit, and find that some textures report their size incorrectly. I'm wondering if anyone else is seeing this problem and whether there is an explanation for it?
Just to rule out any other issues before I report this as a bug. If this is a known bug, please say so.
I'm loading this texture, it is 256x256 pixels in size:
When I log the SKTexture created from this image, then the SKTexture description gives me the correct size but the size
property does not, it says the image is 204.8 x 204.8.
tex = <SKTexture> 'Tileset_GeometryB.png' (256 x 256)
tex.size = {204.80000000000001, 204.80000000000001} // Huh? WTF?!?
tex.textureRect = {{0, 0}, {1, 1}}
I load the exact same texture using the same code on iOS Simulator and device - size property is always correct: 256x256.
I also tried loading this texture before anything else just to avoid any possible side effects. Still the texture size is wrong.
It is worth noting that this doesn't happen with all textures, but does happen on all 256x256 textures I load. A 128x256 texture reports its size correctly.
I also did a clean build, and I'm testing on Mavericks (13A603) with Xcode 5.0.1 (5A2053).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…