0

Using Xcode 8, I have a texture atlas with a bunch of images in it in my project. In the scene editor, I can select a sprite and in the Texture field for thats sprite I can click and get a list of all textures (images) in the project, INCLUDING those in the texture atlas. I select a texture from the texture atlas. When running the app I don't get the texture on the sprite. I get a big red X.

I know I can programmatically get a texture from the atlas and assign it to the sprite. I want to know why the Xcode (IB) assignment to the sprite works inside of Xcode (IB) but not in the running app. I should be able to assign textures from texture atlases inside of Xcode to a sprite.

If I assign a texture from a normal graphics image not in the atlas it works.

chadbag
  • 1,837
  • 2
  • 20
  • 34
  • 1
    It turns out that by removing the spaces in the image names it started to work. I am testing more to figure out before I post an answer. – chadbag Mar 18 '17 at 23:01

1 Answers1

0

Can you select the Assets.xcassets file and see in the File Inspector (far right, first icon, looks like a paper page) if your target is checked in the Target Membership list? This is usually an excellent reason not to get any images from the asset catalog.

Stoyan
  • 320
  • 1
  • 9
  • Thanks. The assets are in a texture atlas, not the asset catalog. And both the asset catalog and the texture atlas are in the target. Thanks, – chadbag Mar 18 '17 at 22:34
  • OK. Just out of curiosity - is there any benefit of using texture atlases outside the asset catalog? – Stoyan Mar 20 '17 at 09:48
  • I need to do the test but I don't think a texture group in the asset catalog is compiled as a texture atlas. The docs give no indication at any rate that a texture group would be compiled as a texture atlas. The docs on texture atlas only specify the directory.atlas way. – chadbag Mar 22 '17 at 18:21