I am a mega-noob to SpriteKit / iOS dev, so sorry if it is a silly query.
What I am attempting to do is have a small recreation introduced in a SwiftUI View. Every part works largely good, besides that for some motive the replace() operate in my GameScene class doesnt operate in any respect.
Sprites will nonetheless animate and transfer as regular, however I am not ready so as to add any additional logic to them.
For instance, the next won’t ever print out ‘howdy world’:
class GameScene: SKScene
{
let loam = Loam() //little sprite character class
//units up scene
override func didMove(to view: SKView)
{
let skView = view
//masses recreation scene
let scene = SKScene(dimension: skView.bounds.dimension)
scene.anchorPoint = CGPoint(x: 0.5, y: 0.5)
scene.backgroundColor = UIColor(purple: 0.9412, inexperienced: 0.8274, blue: 0.7372,alpha: 0.5)
scene.addChild(loam.loam)
skView.presentScene(scene)
}
//known as earlier than every body is rendered
override func replace(_ currentTime: TimeInterval)
{
print("howdy world")
}
}
Am I utilizing replace() improper? Is there some type of conflict between SwiftUI’s SpriteView and SKScene?
Edit: I’ve discovered that eradicating
skView.presentScene(scene)
permits replace() to work- however then it would not render any sprites / animations.