When I run my SpriteKit game, I receive this error multiple times in the console. As far as I can tell (though I'm not completely sure), the game itself is unaffected, but the error might have some other implications, along with crowding the debug console.
I did some research into the error, and found a few possible solutions, none of which seem to have completely worked. These solutions include turning ignoresSiblingOrder
to false
, and specifying textures as SKTextureAtlas(named: "atlasName").textureNamed("textureName")
, but these did not work.
I think the error is coming somewhere from the use of textures and texture atlases in the assets catalogue, though I'm not completely sure. Here is how I am implementing some of these textures/images:
let Texture = SKTextureAtlas(named: "character").textureNamed("\character1")
character = SKSpriteNode(texture: Texture)
also:
let Atlas = SKTextureAtlas(named: "character")
var Frames = [SKTexture]()
let numImages = Atlas.textureNames.count
for var i=1; i<=numImages; i++ {
let textureName = "character(i)"
Frames.append(Atlas.textureNamed(textureName))
}
for var i=numImages; i>=1; i-- {
let TextureName = "character(i)"
Frames.append(Atlas.textureNamed(textureName))
}
let firstFrame = Frames[0]
character = SKSpriteNode(texture: firstFrame)
The above code is just used to create an array from which to animate the character, and the animation runs completely fine.
For all my other sprite nodes, I initialize with SKSpriteNode(imageNamed: "imageName")
with the image name from the asset catalogue, but not within a texture atlas. All the images have @1x, @2x, and @3x versions.
I'm not sure if there are any other possible sources for the error message, or if the examples above are the sources of the error.
Is this just a bug with sprite kit, or a legitimate error with my code or assets?
Thanks!