Contents

preload(_:withCompletionHandler:)

Load the data of multiple textures into memory.

Declaration

class func preload(_ textures: [SKTexture], withCompletionHandler completionHandler: @escaping  @Sendable () -> Void)
class func preload(_ textures: [SKTexture]) async

Parameters

  • textures:

    An array of Sktexture objects.

  • completionHandler:

    A block called after all of the textures are loaded.

Mentioned in

Discussion

SpriteKit creates a background task that loads the texture data for all of the textures in the array, then returns control to your game. Your completion handler is called after all of the textures are loaded.

See Also

Preloading a Texture for Performance