Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Game with Sprite Kit Game Loop and Texture Atlas What is a Texture Atlas?

Stone Preston
Stone Preston
42,016 Points

Texture Atlas not being recognized

The texture atlas is not being recognized. I get an error that the image was not found and the image in the app is just a square with an x. I followed the video, and also made sure to enable auto texture atlas generation mentioned here but it seems xcode does not recognize my atlas folder.

I was able to fix it temporarily by adding the following line before I use any atlas images:

 SKTextureAtlas * atlas = [SKTextureAtlas atlasNamed:@"Sprites"];

but I dont really want to have to add that to every method where I want to use an image. Any ideas Amit Bijlani?

1 Answer

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Is it part of your target? You can check by clicking on your Project Settings then select the Build Phases tab and then look under Copy Bundle Resources. If you don't see it there then add it by clicking on the '+' button.

Stone Preston
Stone Preston
42,016 Points

yes its there. ive also tried removing the folder and adding it back in in addition to restarting xcode

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

Can you share your project? This is odd because I just tried it with a brand new project and it worked for me. Are you working in Xcode 5.1.1?

Stone Preston
Stone Preston
42,016 Points

updated to 5.1.1. was prompted to enable a setting for automatically selecting architectures (or something like that), enabled that. ran and it worked. so it was either the update or the enabling of the setting that did it. thanks!