sceneDidLoad being called twice?

Using Xcode 8, swift 3 and I create a iOS application using the game template with entities enabled. I notice I was seeing double node count for some initial sprites even though I only used addChild once.

I added

  • How to transition scenes in Swift
  • When to use didMoveToView or initWithSize with SpriteKit in xCode 6.4
  • making a scrollview lock on a sprite and enlarging it
  • Issues with batch drawing with atlas files and SpriteKit
  • GIDSignIn keychain error iOS 10 Xcode 8
  • requires a development team. Select a development team in the project editor.Code signing is required for product type 'Application' in SDK 'iOS 10.0'
  • override func sceneDidLoad() {
    print(#function) ... } 

    to the code and no idea why this is being called twice.

    log file…

    2016-09-20 10:21:31.482 MMDecon1[3295:791435] SKUtil.m: MGGetBoolAnswer is not available in the simulator.

    I added

    override func didMove(to view: SKView) {..} 

    and put my initialisation code in here as a temporary fix.

    Does any one know why sceneDidLoad() is being fired twice with the default game app code using entities?

    Solutions Collect From Internet About “sceneDidLoad being called twice?”

    Normally, sceneDidLoad is only called one time. However, if a memory warning is sent then UIViewController releases its scene and sets it to nil if the view controller isn’t visible. The next time that the scene appears the view controller will reload the scene and call sceneDidLoad again.

    You have to assume that sceneDidLoad can be called multiple times.

    Implement didReceiveMemoryWarning and log or set a breakpoint to see what is happening.