Texture in texture atlas is available in Xcode in a scene but not in running app

207 Views Asked by At

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.

1

There are 1 best solutions below

3
Stoyan On

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.