I have a UIViewController which uses ARSCNView and adding few elements to it via Scenekit as shown in below example. Everything is working fine except when I call present to show this view controller, it takes a significant time or delay before presenting on the screen.
@IBOutlet var sceneView: ARSCNView!
override func viewDidLoad() {
super.viewDidLoad()
sceneView.showsStatistics = DebugSettings.isDebugActive
for (index, coach) in coachPositions.enumerated() {
let coachGeometry = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0.005)
let coachNode = TrainEngineNode(position: SCNVector3Make(0, Float(index) * 0.1, -0.5), geometry: coachGeometry)
sceneView.scene.rootNode.addChildNode(coachNode)
}
self.sceneView.autoenablesDefaultLighting = true
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Create a session configuration
let configuration = ARWorldTrackingConfiguration()
// Run the view's session
sceneView.session.run(configuration)
}