Hi
I'm building a SpriteKit app and now i have a problem with the SKTransitions
First, i built the whole app on one ViewController, but i notices fast that this isn't a good solution (it's my first app).
So i made a MenuViewController and a GameViewController, but when i outsourced
let scene = GameScene(size: view.bounds.size)
let skView = view as! SKView
skView.ignoresSiblingOrder = true
scene.scaleMode = .resizeFill
scene.delegate = self
skView.presentScene(scene)
from MenuViewController (MainViewController) to GameViewController I had the problem that the Transition from GameScene to GameOverScene (another SKScene) didn't work. It's strange because i only changed the ViewController and i didn't do anything else on the Code.
I hope you can help me (if you need any other information, please let me know.)
FroiMgg
//Edit
I found out that the problem should be in the transition, because if i delete the transition (view?.presentScene(nextScene as! SKScene)) everything works fine.
Here's the code of the Transition:
func revealGameOverScreen() {
let nextScene: AnyObject!
let direction: SKTransitionDirection!
if secondsOfLife > highScore {
nextScene = GameHighScoreScene(size: self.size, scoreOfLife: secondsOfLife)
direction = SKTransitionDirection.down
highScore = secondsOfLife
} else {
nextScene = GameOverScene(size: self.size, scoreOfLife: secondsOfLife)
direction = SKTransitionDirection.up
}
let reveal = SKTransition.push(with: direction, duration: 2)
view?.presentScene(nextScene as! SKScene, transition: reveal)
}
//Edit 2
Someone else had exaclty the same problem with iOS 9:
https://forums.developer.apple.com/message/85497#85497
It's difficult for me to make a workarround, because it's a SKTransition.push (and it's really important for the game).
I can't delete the ViewControllers because i use an advertising framework and GameCenter (It wasn't possible for me to use these in a SKScene).