CCLabelBMFont addChild problem

CCLabelBMFont addChild problem
0.0 0


I found that it is not possible to add child to CCLabelBMFont. I am trying to add CCSprite and I receive:
Assertion failed: (pSprite->getTexture()>getName == m_pobTextureAtlas>getTexture()->getName()), function addChild

Can anyone else try to reproduce the problem?


All the sprites you added to CCSpriteBatchNode must have the same texture. Otherwise, it will cause this assertion.


I add only one CCsprite to one CCLabelBMFont


Could you paste some codes?


CCLabelBMFont label = CCLabelBMFont::labelWithString;
icon = CCSprite::spriteWithFile(“icon.png”);
label->addChild(icon); //Here it is


icon.png and Customfont.png are not the same texture. It surely produce an assertion.


Customfont.fnt - it is not image, it is bitmap font file


One Customfont.fnt surely have one Customfont.png. If not, how can your bmfont work?


Do you mean the parent and the child must be located in ONE plist/pvr file?


You are right. Have a try. :slight_smile:


I have tried it and this is the same, I still got the error.
Btw, if I use CCLabelTTF - everything is okay. But CCLabelTTF surely using different texture, I have checked it