5

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];
Andriko13
  • 992
  • 1
  • 7
  • 34
  • 2
    The atlas name in the code (planeAtlas) doesn't match the name in the picture. Did you try running from a clean build (Product->Clean and run)? – 0x141E Nov 20 '14 at 10:20
  • Interestingly it's correct in the image (as far as I can decipher it). You are aware that iOS has a case-sensitive file system? Just in case that this might be the issue here. – CodeSmile Nov 20 '14 at 10:45
  • I checked multiple times to see whether my naming was off. The spelling is identical. – Andriko13 Nov 20 '14 at 13:21
  • I know that the name in the picture is correct, and the error occurred in the window in the pic. Did you removing all objects and then running again? If yes, try rebuilding the atlas by deleting the reference to it, creating a new folder, and copying the images to the new folder. – 0x141E Nov 20 '14 at 15:46

1 Answers1

0

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.

jim
  • 1,502
  • 12
  • 23