I've nsmutablearray with levels and two buttons. Next level and try again. When user touched next level, I set objectAtIndex:indexCurrLevel+1 and next level is loading without problem. But if user touched try again and I try to set level to objectAtIndex:indexCurrLevel app crashed with children already added error. That is crazy because if I set manually try again for ex. objectAtIndex:5 works perfectly until user don't playing on 5 level, because app crashed.
For index different than current level index, works perfectly. (objectAtIndex:index - works) manually set index gave the same reason as with index.
[self removeFromParentAndCleanup:YES];
Levels *l = [levels2 objectAtIndex:index-1];
Game *hl = [[Game alloc]initWithObstacles:[l staticO] :[l rotateO]:[l lvl]:[l level]:[l pendulumO]:self.levelsArray];
[hl setLevels2:self.levels2];
[hl setBasketY:[l basketY]];
[hl setBasketX:[l basketX]];
[l release];
[[CCDirector sharedDirector] replaceScene:(CCScene*) hl];
[hl configureLevel];
[hl release];
Eroor: Assertion failure in -[Game addChild:z:tag:], ../libs/cocos2d/CCNode.m:388 2012-05-11 19:03:20.349 Game[932:10a03] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'child already added. It can't be added again' * First throw call stack: