I am trying to trigger a method by handling a touch event on the entire scene in a game with AndEngine. However now, every time I tap the screen it throws me a verbose level message
"org.andengine.input.touch.TouchEvent$TouchEventPool<TouchEvent> was exhausted, with 0 item not yet recycled."
and
"org.andengine.util.adt.pool.PoolUpdateHandler$1<TouchEventRunnablePoolItem> was exhausted, with 0 item not yet recycled."
and doesn't do anything besides that.
What is going on here, am I missing something with how SceneTouchEvents are handled? Can I fix this by somehow allocating more Touch Events to said pools?
-Thank you,Cheers!
Edit: Method I am trying to call:
private void restartGame(){
Debug.d("GameMech", "Restart method triggered.");
setIgnoreUpdate(true);
unregisterUpdateHandler(physicsWorld);
enemyFlies.clear();
platforms.clear();
physicsWorld.clearForces();
physicsWorld.clearPhysicsConnectors();
while (physicsWorld.getBodies().hasNext()){
physicsWorld.destroyBody(physicsWorld.getBodies().next());
}
camera.reset();
camera.setHUD(null);
camera.setChaseEntity(null);
detachChildren();
populate();
setIgnoreUpdate(false);
}
With this onSceneTouch Method:
@Override
public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
if(pSceneTouchEvent.isActionDown() && player.isDead()){
restartGame();
return true;
}
return false;
}
This sometimes happens if you forget to register the scene in your game activity. Should be something like this:
scene.setOnSceneTouchListener(this);
See this tutorial for more information.