When making transition to a new scene, (i am calling a instance of self for the new scene), I am trying to set the level number as a property of the new instance.
Problem is when the instance is first created initWithSize is called before I can set the level property, and i can only set the level property after the instance created, therefore the property level is always set to its default (0) when initWithSize first called.
MyScene *destinationScene = [[MyScene alloc]init];
destinationScene.currentLevel = (int) level;
NSLog(@"519 Level Passed: %d New Level: %d", (int)level, destinationScene.currentLevel);
SKTransition *transtition = [SKTransition doorwayWithDuration:2];
[self.view presentScene:destinationScene transition:transtition];
InitWithSize: check for level number here and load
_currentLevel = self.currentLevel;
// check if no level ie loading game first time
if (_currentLevel==0) {
_currentLevel=1;
}
[self loadLevel:_currentLevel];
Only way around it I have found is to call initWithSize twice which uses up memory and is messy. Any feedback appreciated.