I have a SceneKit game that I'm attempting to integrate with GameplayKit.
In order for GameplayKit to work, I need to update my components and entities by calling their updateWithDeltaTime(seconds:)
method.
In the SpriteKit/GameplayKit examples I've seen, this is done using the SKScene's update
method which fires continuously with no input from the user or the developer.
It seems that in SceneKit, to achieve something similar I need to call the SCNSceneRendererDelegate
method renderer(renderer: updateAtTime time:)
.
However, this only fires when something in the scene is running, such as an SCNAction. But in my game, nothing is running until the user swipes.
Is there another, recommended SceneKit way to hook into some sort of run loop that runs continuously without any sort of prompt?
By default, SceneKit doesn't run the animation loop unless it knows there's something animating. That can include actions, animations, or physics.
If you want the animation loop to run without any of those things going on, set the view's playing
property to true.