开发者

[[CCDirector sharedDirector]replaceScene: crashes game

开发者 https://www.devze.com 2023-02-07 13:25 出处:网络
I get the following error report after my game crashes on startup. When I try to replace the scene using

I get the following error report after my game crashes on startup.

When I try to replace the scene using

[[CCDirector sharedDirector]replaceScene:[CCZoomFlipXTransition transitionWithDuration:1 scene:[MainMenu node]]];

I get the error and it crashes the app.

* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSMutableArray replaceObjectAtIndex:withObject:]: index 4294967295 beyond bounds for empty array'

What is the cause of this, I'm not sure what I am doing wrong?

T开发者_如何学Gohanks


If it's the first scene you are loading you need to use runWithScene not replaceScene.

[[CCDirector sharedDirector] runWithScene:[MainMenu scene]];
0

精彩评论

暂无评论...
验证码 换一张
取 消