Hello, I’m using cocos2d-x-3.0rc0.
I’m creating a loading scene and I’m trying looping a function that precaches all my files and updates my progress bar after each precache. Therefore I need to call the function again and again but If I do that directly the application crashes when I try to replace scene.
Assert failed: Use runWithScene: instead to start the director
Assertion failed: (_runningScene)
However I came up with the solution that I should schedule a new function and call the other function from there.
So what I am doing now is:
this->schedule(schedule_selector(LoadingScene::keepLoading), 0.00f);
void LoadingScene::keepLoading(float dt)
{
this->unschedule(schedule_selector(LoadingScene::keepLoading));
loadAssets();
}
But I need a more efficient solution than this. Any ideas?