How do I load textures from Internet using TextureAtlas in IOS?

108 Views Asked by At

First I added textures to the project before compilation and SKTextureAtlas created a set of textures with correct size based on .atlasc folder. But when the number of textures grows it becomes not rational to store them in project so I started to load them from net. SKTextureAtlas doesn't assemble them but asks to add them manually by picture. I use TexturePacker to store textures. How to work with textures loaded from net? Or how to cut out them from texturePacker correctly using JSON or .plist?

1

There are 1 best solutions below

0
Max Gribov On

You can simply create SKTextureAtlas at runtime using class method: atlasWithDictionary:. Just feed it with images you downloaded from anywhere.

More details see in documentation: https://developer.apple.com/documentation/spritekit/sktextureatlas/1427383-atlaswithdictionary?language=objc