1
votes

I have placed some of my texture atlases outside my app.bundle. This does not seem to work. Although the path is correct, and I use the compressed texture output (.atlasc) the SKTextureAtlas command can't find the atlas? Anyone have any idea?

The Apple documentation says: "An SKTextureAtlas object is a collection of related texture objects created from a texture atlas stored inside the app bundle." .

So that doesn't seem hopeful. But I can't imagine why this would be. For example if you have a game downloading extra levels with textures. This would not be possible if you can't load the textures outside of the app.bundle.


To further explain; After purchase the app downloads an in-app purchase package, from that package the app copies some texture atlases (like Textures.atlasc) to the documents folder. And from the documents folder I try to load the textures something like this;

NSString *roadTextures = [NSString stringWithFormat:@"%@Textures.atlasc",mapPath];
self.textures = [SKTextureAtlas atlasNamed:roadTextures];

I've tried different methods, by not including .atlasc or any extension at all. I have checked if the files are in the document folder and they are.

1
Can you post the code which you use to move the files there, and the code for accessing them? - ZeMoon
You are expected to provide an app update if you want to distribute extra levels with extra graphics to your users. - LearnCocos2D
What would be the use of the in-app purchase when downloaded stuff can't be used? - DionMes
I am gonna choose this method now, but I don't agree with you. In-app purchases have a download option, either via apple or your own hosted content. You should be able to use that downloaded content in your app. Otherwise I don't see the reason to download content. - DionMes
Thanks to Benny Khoo! This solution will help. github.com/bennyk/MyTextureAtlas - Den

1 Answers

1
votes

I'm pretty sure that you can't use SKTextureAtlas like that. SKTextureAtlas accepts a name for the .atlas file and then from that obviously looks for a compiled .atlasc. You can't override this behaviour unfortunately. And if you did, Apple probably wouldn't approve it. I think you will have to do this manually by parsing the .plist file yourself or by just using normal SKTextures.