Question

I have noticed that when using SKLabelNode there is a second unnamed node added to the node tree. This node is actually an SKSpriteNode which I am assuming is being used to display the text for the label, can anyone confirm this as I can't find any mention of this in the docs. My understanding was that SKLableNode was a single self-contained node, I was curious to find out when looking at my display graph that it appears to have brought a friend to the party.

enter image description here

Was it helpful?

Solution

Yes, each label has a single SKSpriteNode child. Presumably the sprite is used to render the texture created from the label's font and text.

You won't find this mentioned in the docs as this is Sprite Kit internal behavior and subject to change.

PS: SpriteKit-Quicklook helps to find such Sprite Kit anomalies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top