0

When I move from GameScene(SKScene) to the Market(UIViewController) and back , the FPS decreases. Can you please say Why? , and where is the problem? The MarketView is the Empty and there is no evidence, only a transition which is carried out through the protocol (SKScne), which binds GameScene and GameViewController. Code:

//GameScene

import SpriteKit
protocol GameDelegate {
func Market()
func Question()
}
...
func returnToMarket(){
self.viewController.Market()
}
// GameViewController

class GameViewController: UIViewController , GameDelegate{
func Market() {
    let storyBoard : UIStoryboard = UIStoryboard(name: "Market", bundle: nil)
    let vc : UIViewController =         storyBoard.instantiateViewControllerWithIdentifier("Market") 
    self.presentViewController(vc, animated: true, completion: nil)
}
...


}

// Market(UIViewController)
func ReturnToMainMeny() {
    let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
    let vc : UIViewController = storyBoard.instantiateViewControllerWithIdentifier("GameViewController")
   self.presentViewController(vc, animated: true, completion: nil)

}
  • I know that you're creating a new instance of each ViewController when you run the function. Is it being removed afterwords? – Charles Truluck Oct 06 '15 at 19:00
  • what FPS is decreasing? is the entire animation of the view controller being loaded slow, or is it just game scene? Also, are you sure that it is being slow or is the game scene just pausing. Finally, it looks like you are just loading view controller on top of view controller here, You may want to look into setting up a delegate, so that the market view controller will tell the game it is dismissing, and then the game will dismiss. – Knight0fDragon Oct 06 '15 at 19:59
  • Here is an example http://stackoverflow.com/questions/6168919/how-do-i-set-up-a-simple-delegate-to-communicate-between-two-view-controllers, I know it is objective C, but it can at least give you an idea on what to do. – Knight0fDragon Oct 06 '15 at 20:04
  • Charles Truluck: sorry i don't understand what is the afterwords. KnightOfDragon: the FPS decreasing is the entire animation of the all game being loaded slow. Can I send the video anywhere (mail) , because I think that I can't explain that on grammatical english. – Nikola Cvetkovic Oct 07 '15 at 06:37

0 Answers0