Texture Atlas Cannot Be Found

1.7k views Asked by At

I have a texture atlas named plane1.atlas, which contains many images. When I init the Atlas and try to use one of the textures, I get the error message "Texture Atlas Cannot Be Found". As you can see in the following photo, I have the code to initialize the texture, I have the texture atlas in the bundle, and the error log shows the error.

atlas problems

I have the correct settings in the target settings, I tried renaming the texture atlas and using the file name extensions when initializing/using any of the textures (I added the .atlas and .png, doesn't work). I tried other images as well, to no avail. Does not work both on devices and simulators, although I reset the contents/settings multiple times.

Here is the code in case it's too small in the image:

SKSpriteNode *planeCore;
SKSpriteNode *planeOutline;
SKSpriteNode *planeEngine1;
SKSpriteNode *planeEngine2;
SKSpriteNode *planeWheels;
SKSpriteNode *planeWindows;

SKTextureAtlas *plane1Atlas = [SKTextureAtlas atlasNamed:@"planeAtlas"];
planeCore = [SKSpriteNode spriteNodeWithTexture:[plane1Atlas textureNamed:@"plane1Core1"]];
planeCore.position = CGPointZero;
planeCore.zPosition = 500;
[self addChild:planeCore];
1

There are 1 answers

0
jim On

In some instructions, it says to add "New Folder" and then add images.

I had the same issue, solved by;

Deleting the folder. Add New Sprite Atlas (XCode, right click in the outline view) Add images to that new atlas.