我有一个表格视图,列出了我的游戏地图。当我点击一个时,另一个故事板加载包含一个cocos2d场景。
第一次加载场景时,一切都完美加载。但是,我第二次尝试加载场景(从导航控制器返回并点击相同的地图或其他地图),我得到一个空白屏幕显示fps,但没有别的。
这是我在mapViewController中的代码(包含cocos2d)
- (void)setupCocos3D { //called from viewDidLoad
[[CCDirector sharedDirector] setOpenGLView:openGLView];
((ViewInterface*)[ViewInterface sharedViewInterface]).currentScene = [testScene scene];
// Create the customized CC3Layer that supports 3D rendering.
CC3Layer* cc3Layer = [HelloWorldLayer node];
// Create the customized 3D scene and attach it to the layer.
// Could also just create this inside the customer layer.
cc3Layer.cc3Scene = ((ViewInterface*)[ViewInterface sharedViewInterface]).currentScene;
// Assign to a generic variable so we can uncomment options below to play with the capabilities
CC3ControllableLayer* mainLayer = cc3Layer;
mainLayer.contentSize = CGSizeMake(2048, 1320);
[CCDirector sharedDirector].animationInterval = (1.0f / kAnimationFrameRate);
[CCDirector sharedDirector].displayStats = YES;
[[CCDirector sharedDirector] enableRetinaDisplay: YES];
((ViewInterface*)[ViewInterface sharedViewInterface]).mainLayer = mainLayer;
[[CCDirector sharedDirector] runWithScene:((ViewInterface*)[ViewInterface sharedViewInterface]).mainLayer];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[[CCDirector sharedDirector] end];
}
我真的很奇怪,我可以看到fps因此似乎唯一的问题是场景或图层。
答案 0 :(得分:0)
是否保留了场景?它可能会被释放而不会被重新创建吗?