It is true that spriteNodeWithImageNamed: will search for the file in the package first. If he cannot find the package file, he checks if an image with the same name exists in the atlas available in the bundle.
If the Sprite Kit finds an image with this name in any atlas, it will automatically download this atlas to use the specified image as a sprite when using the spriteNode/initWithImageNamed: initializers. This makes it easy to start development without atlases, and then add files to the atlas.
I recommend using atlases from the very beginning, because there can be subtle differences, and you can more effectively evaluate the performance of your application.
Yes, the Sprite Kit is smart enough not to reload a resource that is already in memory. It also will not create a new instance of one atlas, but rather will return you a pointer to an existing atlas with the same name.
Sprite Kit also uses a caching mechanism, so even if the last strong link to the resource file was deleted, the file will remain in memory. However, I donβt think anyone has done a detailed analysis of how and when and in what order the Sprite Kit ultimately releases cached instances from memory.
In short: rely on the Sprite Kit to do the right thing for you.
source share