i searched for a few hours but i can´t find what i´m actually searching for..
i want to free up my memory when im switching from a gameScene to my menuScene. as i read, it is possible if i add a viewController for each Scene and perfom Segues instead of transitions. but i want to keep it simple and use just one viewController. in addition to the first solution, it is possible to use UIImage´s instead of SKtexture. UIImage`s frees up their memory automatically by transition so i tried, and tried and i ended up here: (obviously not working)
//Load Animations
barrierUfoAtlas = [SKTextureAtlas atlasNamed:@"BarrierUfoAnimation"];
[barrierUfoAtlas preloadWithCompletionHandler:^{
NSArray *barrierUfoAtlasNames = [barrierUfoAtlas textureNames];
NSArray *sortetBarrierUfoAtlasNames = [barrierUfoAtlasNames sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
NSMutableArray *barrierUfoTextures = [NSMutableArray array];
for (NSString *filename in sortetBarrierUfoAtlasNames) {
NSData *imageData = [NSKeyedArchiver archivedDataWithRootObject:[barrierUfoAtlas textureNamed:filename]];
UIImage *image = [UIImage imageWithData:imageData];
SKTexture *texture = [SKTexture textureWithImage:image];
[barrierUfoTextures addObject:texture];
}
self.barrierUfoAnimation = [SKAction animateWithTextures:barrierUfoTextures timePerFrame:0.0389];}];
can somebody help?