I have a function that saves all the nodes on my scene and one that will add them back (these work well while the app is open). The issue I am having is how would I go about saving that array so it can be called when the app reopens. Thanks in advance for assistance.
Added the code for my nodes to give a better idea of what im trying to accomplish
let bubble = SKShapeNode(circleOfRadius: self.frame.size.width / 12)
bubble.position = testBubble.position
bubble.fillColor = SKColor.black
bubble.strokeColor = SKColor.black
bubble.name = "bubble"
bubble.physicsBody = SKPhysicsBody(circleOfRadius: bubble.frame.height / 2)
bubble.zPosition = 2
let bubbleLabel = SKLabelNode(text: "Bubble")
bubbleLabel.fontColor = UIColor.darkGray
bubbleLabel.fontSize = 10
bubbleLabel.fontName = "MarkerFelt-Thin"
bubbleLabel.position.y = bubble.frame.size.width / 2 -bubble.frame.size.height / 1.65
bubbleLabel.zPosition = 3
self.addChild(bubble)
bubble.addChild(bubbleLabel)
@objc func saveAllNodes() {
nodeArray.removeAll()
for node in self.children {
nodeArray.append(node)
}
}
@objc func addAllNodes() {
self.removeAllChildren()
for node in nodeArray {
self.addChild(node)
}
}