Moving from SKScene to ViewController

I want to move from my SKScene to a ViewController when I touch a Spritenode and back to SKScene when I touch an UIButton. It is working from ViewController to SKScene and also the other way around, but only the first time. When I then go back to my SKScene and the move to the ViewController again (the second time), I can hear the music and it prints me everything from the viewdidload, but it does not the show me UI Elements. I dismissed the SKScene so that might not be the problem.

Here is the code for moving back from the SKScene to the ViewController.

            let currentViewController:UIViewController = UIApplication.shared.keyWindow!.rootViewController!

            currentViewController.present(ViewController(), animated: false, completion: nil)

My english is not really the yellow from the egg but I hope you understand my Question.

Powered by WPeMatico

You may also like...

Comments are closed.