sprite kit - Significant fps drops when unpausing the view in Spritekit -


i've noticed significant fps drops (framerate drops between 5-10fps), when unpausing view in spritekit. tried empty project (spritekit game template). here code:

if(!self.view.paused){         self.view.paused = yes;         nslog(@"paused");     }else{         nslog(@"unpaused");         self.view.paused = no;     } 

if pause scene, works expected , frames steady @ 60fps. testing on device.

if(!self.paused){         self.paused = yes;         nslog(@"paused");     }else{         nslog(@"unpaused");         self.paused = no;     } 

this can make problem gameplay when unpausing because frames skipped... thoughts what's going on ?

i'm assuming dropping temporarily after un-pause? or low fps after un-pausing. happening on ios 8 or ios 9. can try ios 9? i'm convinced might occurring because after un-pausing takes sprite-kit little "warm-up" rendering cycle. can try profiling in instruments , see happening.

as solution, can try lowering speed of skphysicsworld temporarily after un-pausing physics don't jump because sprite kit has variable time step , unfortunately can't changed. if it's actions jumping, can try lowering speed of skscene. ideally should both.

additionally, if need worry actions, can try pausing scene instead of skview (but keep in mind update method run). or try temporarily pausing scene un-pausing after un-pausing skview.

other this, there not else can fix other try prepare dropped frames. report apple if haven't already.

below class reference of these properties.

skview-paused

if value yes, scene’s content fixed onscreen. no actions executed , no physics simulation performed.

skscene - speed

the default value 1.0, means actions run @ normal speed. if set different speed, time appears run faster or slower actions executed on node , descendants. example, if set speed value of 2.0, actions run twice fast.

skscene - paused

if value yes, node (and of descendants) skipped when scene processes actions.

skphysicsworld - speed

the default value 1.0, means simulation runs @ normal speed. value other default changes rate @ time passes in physics simulation. example, speed value of 2.0 indicates time in physics simulation passes twice fast scene’s simulation time. value of 0.0 pauses physics simulation.


Comments