I am getting this exception in logs
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'CCSprite is not using the same texture id'
What I am trying to do is adding a normal "myfile.png" file to a SpriteBatchNode
**declaration of batch node
CCSpriteBatchNode *_backgroundLayer = [CCSpriteBatchNode batchNodeWithFile:@"sprites.png"];
** usage
This line works perfect
CCSprite *sprite1 = [CCSprite spriteWithSpriteFrameName:@"PngFileKeptInSpriteSheet.png"];
[_backgroundLayer addChild:sprite1];
But, when I use a direct *.png file to add to batch node, It crashes
CCSprite *sprite2 = [CCSprite spriteWithFile:@"myfile.png"];
crashes on line
[_backgroundLayer addChild:sprite2];
On further debugging I found that:
The assertion failure is in file CCSpriteBatchNode.m
inside method -(void) addChild:(CCSprite*)child z:(NSInteger)z tag:(NSInteger) aTag
at line NSAssert( child.texture.name == textureAtlas_.texture.name, @"CCSprite is not using the same texture id");
P.S. : by "normal" I mean not taken from *.plist file