I've done some research and I can't seem to find anything that clearly explains how to go about preloading both single textures and textures within animations. I'm currently using Atlas
's in Assets.xcassets
to group related animation images. Does having my images in the Atlas mean that they are preloaded? As far as single images, does it make sense to declare the texture before GameScene
like this: let laserImage = SKTexture(imageNamed: "Sprites/laser.jpg")
and then (for example) within one of my SKSpriteNode subclass I can just pass laserImage
through?
I ultimately wanted to know if there was a well defined way of going about this or if I should just store each texture as a constant before GameScene
. Any advice on the proper (and most efficient) way of going about this would be great.
.preloadWithCompletionHandler
on the Atlas, how should I reference the images? Would I just reference the image name with no extension? Also, does this mean that it never makes sense to have separate Atlas's for groups of related images that pertain to one animation? Thanks a lot. – Pandurate