Contents

preloadTextureAtlasesNamed(_:withCompletionHandler:)

Loads the textures of multiple atlases into memory, calling a completion handler after the task completes.

Declaration

class func preloadTextureAtlasesNamed(_ atlasNames: [String], withCompletionHandler completionHandler: @escaping  @Sendable ((any Error)?, [SKTextureAtlas]) -> Void)
class func preloadTextureAtlasesNamed(_ atlasNames: [String]) async throws -> [SKTextureAtlas]

Parameters

  • atlasNames:

    An array containing the atlas names to preload.

  • completionHandler:

    A block called after all of the texture atlases are loaded.

Discussion

SpriteKit creates a background task that loads the texture data from all of the specified atlas objects. Then, SpriteKit returns control to your game. After the atlases are loaded, your completion handler is called.

See Also

Preloading Textures