sceneDidLoad being called twice?

后端 未结 1 1196
眼角桃花
眼角桃花 2020-12-28 08:35

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 th

相关标签:
1条回答
  • 2020-12-28 08:47

    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.

    0 讨论(0)
提交回复
热议问题