preload(completionHandler:)
Loads an atlas object’s textures into memory, calling a completion handler after the task completes.
Declaration
func preload(completionHandler: @escaping @Sendable () -> Void)func preload() asyncParameters
- completionHandler:
A block called after the texture atlas is loaded.
Mentioned in
Discussion
SpriteKit creates a background task that loads the texture data from the atlas object. Then, SpriteKit returns control to your game. After the texture atlas is loaded, your completion handler is called.
If you need to preload multiple texture atlas objects immediately, use the preloadTextureAtlases(_:withCompletionHandler:) method instead.