I’m using XCAssets texture atlases to store different versions of a game character, like so:
Characters.xcassets:
- HeroPirate sprite atlas:
- - HeroIdle (separate sets for iPhone, iPad, Apple TV and OSX, not using Universal)
- - HeroWink
- - HeroWalkLeft
- - HeroWalkRight
…
- HeroCowboy sprite atlas:
- - HeroIdle
- - HeroWink
- - HeroWalkLeft
- - HeroWalkRight
…
- Hero
I would expect that calling
let atlas = SKTextureAtlas(named: “HeroCowboy”)
would load all HeroCowboy textures when placing a breakpoint after the statement and using quick look to see the atlas’ contents.
However, depending on the Deployment Target (I’ve tried 8.0, 9.0 and —in Xcode 7.2 beta 3— 9.2) the atlas either contains one or three out of eight.
With “Provides Namespace” in the atlas options set to off (the default), I see many “The image set name “HeroIdle” is used by multiple image sets” warnings, suggesting sprite atlases are automatically combined by Xcode. These warnings disappear when “Provides Namespace” is turned on (the sprite atlas folders become blue instead of yellow), but did not solve the issue. Renaming the sprites to unique names did not solve the issue (suggesting the issue might not be related to reusing image set names).
I noticed DemoBots only uses Universal (@1x, @2x and @3x) and Mac (@1x and @2x) image sets for xcassets sprite atlases.
Is there something obvious I'm doing wrong or should I only use Universal and Mac in xcassets texture atlases, like DemoBots, or should I perhaps go back to .atlasc folders?