So I am using an if else statement with a UIGestureRecognizer. Something just isn't clicking on my mind. But I set the node in an if statement and I am trying to use it in the else statement. But it is printing 'nil' so I am pretty sure I am doing something wrong like the scope. Thank for your help.
var node: SCNNode?
if recognizer.state == .began {
print("scale began")
node = sceneView.scene.rootNode.childNode(withName: "aNode", recursively: false)
print(node?.name)
}
else if recognizer.state == .changed {
print("scale node name change: \(node.name)")
}
Aucun commentaire:
Enregistrer un commentaire