Reputation: 8720
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?
Upvotes: 3
Views: 1142
Reputation: 64477
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.
Upvotes: 3