I have a CCSpriteBatchNode that is added to my Scene.
I have a CCSprite that is created with "initWithSpriteFrameName," then I add it to my batch node.
The sprite displays correctly. However, after that I add a CCLabelTTF as a child to the CCSprite, and the app crashes with the following error:
"CCSprite is not using the same texture id"
Is there any way to add the Label as a child node of the sprite?
You can add the label only if you don't add the CCSprite to a CCSpriteBatchNode. CCSpriteBatchNode only allows CCSprite as children, and that also extends to children of children.
If that's not an option, simply add the label to the scene hierarchy elsewhere and then update the position of the label to the sprite's position using an update method, in order to synchronize the label's and sprite's positions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With