I have a game made of several chessboards set up in an AR environment.
I need at some point to have some of the chessboards to blink.
I'm doing it with a SCNAction executed in the renderer loop of the scene as described below.
func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval)
{
if Blink { TargetNode.runAction(SCNAction.repeat(SCNAction.sequence([SCNAction.hide(), SCNAction.wait(duration: 1), SCNAction.unhide(), SCNAction.wait(duration: 1)]), count: 10)) }
}
The TargetNode is a node made of hundreds of child nodes (one of the chessboards with all cells as individual nodes and pieces also as individual nodes, all children of TargetNode). Blink is a flag defined somewhere else.
After a few seconds or minutes, I end up with an error :
com.apple.scenekit.scnview-renderer (16): EXC_BAD_ACCESS (code=1, address=0x68)
After having read some literature on this issue, I've came to understand that it is mandatory to have node modification happening within the renderer thread, which is the case here. At least it is called from the renderer thread.
I'm guessing that the way the SCNAction is built can't really secure that it is executing as expected.
Is there a way to do this differently or secure the execution of this SCNAction (preferably) ?
Thx