Issues with batch drawing with atlas files and SpriteKit
So I ran into a problem with lag on a platformer game I’m building. So I’m researching how to improve performance.
I’m trying to do batch drawing, so that there is less draw calls. I’m having issues though. So with a brand new project:
I have 4 hero sprites, all images are stored in a .atlas folder. so there is a 1/2/3x image for each sprite in the atlas folder.
I drag and drop that into the xcassets folder. Then I go to my sks file create 4 sprites and change the texture accordingly.
By default they all have the same blend mode. I have the default rule set to true for ignoring sibling order. All sprites are on the default z 0 layer. and I have it set to show draw count.
I would expect to see 1 draw since all images are in the same atlas file, but I see 4.
Is there something I’m missing?
Just curious how I get this to work properly. Thanks for any help!!!
- requires a development team. Select a development team in the project editor.Code signing is required for product type 'Application' in SDK 'iOS 10.0'
- GCD and async NSURLConnection
- Get location name from Latitude & Longitude in iOS
- How to make .ipa file in Xcode 4.5?
- iPhone app localization by releasing separate apps for different markets
- Tap Gesture with UIGestureRecognizerState not working
Solutions Collect From Internet About “Issues with batch drawing with atlas files and SpriteKit”
There was a bug with xcassets on iOS 9 where draw calls wouldn’t be reduced even if images were placed in xcassets. Apparently that was fixed with later versions, but since then I never bothered with xcassets. Instead I place images in a seperate .atlas folder in the project, which does reduce the draw calls.
Try to place 4 sprites with the same texture and see what the draw calls are then. It shouldn’t be 4 if the sprites are using the same texture. I would also suggest to add 8 sprites (4 different textures * 2 sprites each) and see if the draw calls increase to 8.
If the draw calls don’t increase, then I would assume that 4 draw calls is what it takes to draw your 4 different sprites (if they are very complex ones). If the draw calls do increase, try removing the images from xcassets and place them into a seperate .atlas folder in your project, and compare draw calls then.
- The anatomy of getting chat server data from iOS to WatchOS?
- Xcode – multiple URL Schemes
- A Swift protocol requirement that can only be satisfied by using a final class
- Custom UIPickerView with three Components each showing label on Selection Indicator
- Loading web page in UIWebView in Xcode 4.2 — how to connect IBOutlets properly and ensure the web page loads?
- Using NSUserDefaults with Xcode 8 and iOS 10
- Installed Google Drive API, but have the error “no such module 'GoogleAPIClient'”
- Can't make URL clickable in UITextView
- Understanding KVO in iOS
- Getting Outlook .msg file contents with Objective-C
- How to detect user is mid-way inputting with an Input Method?
- Difference between optional values in swift?
- nested push animation can result in corrupted navigation bar multiple warning
- Xcode 7 – Code coverage data generation failed
- Using object from one class in another