I am trying to hide a node when it's clicked and unhide it when a button is clicked. After unhiding the node, I can't click it again but I want it to be clickable again. Below is my code for hiding and unhiding using SKAction. Am I missing something?
when the ball Node is clicked it is hidden and added to an array clickedBall
ballNode.runAction(SKAction.hide())
clickedBall.append(ballNode)
when the button is clicked, it is shown via array clickedBall
clickedBall.last?.runAction(SKAction.unhide())
but I can't click the node again to hide it again..
please help.. thank you
When the node is clicked, instead of running an action, you can use the node's 'hidden' property:
and then set the value to
false
when you want the node to reappear