3
votes

I'm trying to debug a very strange behaviour of SpriteKit animation. It's quite easy to reproduce:

  1. Create a new Game project in Xcode leaving all the options unchanged.
  2. Open GameScene.swift and change line #23 from label.run(SKAction.fadeIn(withDuration: 2.0)) to label.run(SKAction.fadeIn(withDuration: 0.2))
  3. Connect your phone and start a debugging session, observe how the text (Hello, World!) fades in and appears in full brightness. Well, so far, so good.
  4. Stop the application from Xcode and start it again clicking its icon on your phone.
  5. Observe how the text, although visible, is not faded in completely.

I found this trying to understand why my animation just stops half the way when my application loads. I assume that somehow the view stops refreshing if some initialisation step is longer than the animation but I don't know how to fix this. I also noticed that if you click on the screen it refreshes and the animated view appears in the final state.

iOS version: 10.3

1
Well found and isolated! - Confused

1 Answers

0
votes

I've discovered a serious issue with iOS11 and SpriteKit. The Game Scene during the transition is getting paused automatically (but only in iOS11).

After transitioning to the scene run

myScene.isPaused = false

and it should fix the issue, and should have no adverse affects when the game is run on iOS10