2

I just switched the textures in my SpriteKit game to using a Sprite Atlas. It is all working fine when I test on the Simulator, but on my connected actual iPhone, it does not. All textures in the atlas display in a sort grid pattern, shrunken and warped to fit the SKShapeNode.

Here is the code I'm using

let spriteTextureAtlas = SKTextureAtlas(named: "Sprites")

override func sceneDidLoad() {

spriteTextureAtlas.preload {}

func spriteCreator() -> SKShapeNode{
        sprite = SKShapeNode.init(circleOfRadius: 20)
        sprite.fillTexture = spriteTextureAtlas.textureNamed("spriteTexture")

        return sprite
}

I'm sure it is some stupid mistake, but cannot figure out what.

Thanks for the help!


UPDATE

I'm only working with 5 totally seperate textures. If I create a new atlas for every texture, it works fine. This seems inefficient? Or is this what I should be doing, as these textures are not frames of the same animation.

Muindor
  • 177
  • 1
  • 9

1 Answers1

1

I had a similar problem but my textures weren't showing up on my device or the simulator. I fixed the problem by deleting the folder with my textures in it and creating a new folder using Xcode, and then dragging copies of the images into the folder I created.

GTG101
  • 149
  • 13