我得到这个例外日志将正常CCSprite以CCSpriteBatchNode崩溃
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'CCSprite is not using the same texture id'
我所试图做的是增加一个正常的“myfile.png”文件到SpriteBatchNode
**声明一批节点的
CCSpriteBatchNode *_backgroundLayer = [CCSpriteBatchNode batchNodeWithFile:@"sprites.png"];
**使用
这行工作PERF ECT
CCSprite *sprite1 = [CCSprite spriteWithSpriteFrameName:@"PngFileKeptInSpriteSheet.png"];
[_backgroundLayer addChild:sprite1];
但是,当我使用直接* .png文件添加到一批节点,它崩溃上线
[_backgroundLayer addChild:sprite2];
CCSprite *sprite2 = [CCSprite spriteWithFile:@"myfile.png"];
崩溃关于进一步调试我发现, :
断言失败在文件中CCSpriteBatchNode.m
内部方法-(void) addChild:(CCSprite*)child z:(NSInteger)z tag:(NSInteger) aTag
在线路NSAssert(child.texture.name == textureAtlas_.texture.name, @"CCSprite is not using the same texture id");
P.S. :通过“正常”我的意思是不采取* .plist文件
什么版本的cocos2d? – trojanfoe 2014-09-04 06:37:55
COCOS2D_VERSION 0x00010001 – 2014-09-04 06:45:54
那么是1.1还是你是编译器? – trojanfoe 2014-09-04 06:48:49