I have been trying for a while to display a simple SKLabelNode, with no luck. I have tried many different ways, with mixed results. This is what I have currently, but nothing shows up:
func layoutMenu() {
let appNameLabel = SKLabelNode()
appNameLabel.text = "HI"
appNameLabel.zPosition = 1000
appNameLabel.fontColor = SKColor.red
appNameLabel.position = CGPoint(x:0.5, y:0.5)
self.addChild(appNameLabel)
}
I call this function in the didMove() function. By mixed results, I mean that sometimes the label's red color shows up in a blurry block (no text though). This was only achieved using the alignment properties, which I would prefer not to use.
Edit: some info about the frames which may be useful.
The root skscene frame:
▿ (-0.0, -0.0, 1.0, 1.0)
▿ origin : (-0.0, -0.0)
- x : -0.0
- y : -0.0
▿ size : (1.0, 1.0)
- width : 1.0
- height : 1.0
And the SKLabelNode:
▿ (-11.5, 0.5, 25.0, 25.0)
▿ origin : (-11.5, 0.5)
- x : -11.5
- y : 0.5
▿ size : (25.0, 25.0)
- width : 25.0
- height : 25.0