Why is the layer in scene not calling its destruct method when the scene is replaced???


#1

The TowerScene is my gamescene,and there is a layer called Tower added into it.

bool TowerScene::init()
{
	addChild (Tower::create());

	return true;
}

But I’ve never been seeing the ~Tower() method called when the Towerscene destructed.

TowerScene::~TowerScene()
{
	CCLOG("TowerScene destructed");

}



Tower::~Tower()
{
	CCLOG("Tower Layer destructed");

	if(loader)
	{
		loader->removeAllPhysics();
		delete loader;
		loader = NULL;
	}

	if(next_loader)
	{
		next_loader->removeAllPhysics();
		delete next_loader;
		next_loader = NULL;
	}

	if(m_world)
	{
		delete m_world ;
		m_world =NULL;
	}
}