我得到這個例外日誌將正常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