void Scene::Instantiate( GameObject* obj, int layerRank )
{
	if (obj == NULL)	return;
	if ( layerRank < 0 && layerRank >= (int) m_layers.size() )		return;

	m_layers[layerRank]->AddObject( obj );

	Transform* transform = obj->GetComponent<Transform>();
	for (uint i = 0; i < transform->GetChildCount(); i++)
	{
		Instantiate( transform->GetChildAt(i)->GetGameObject(), layerRank );
	}
}
void Scene::Instantiate( GameObject* obj, std::string layerName )
{
	if (obj == NULL)	return;

	int layerRank = GetLayerRank(layerName);
	if ( layerRank == INVALID_LAYER )	return;

	m_layers[layerRank]->AddObject( obj );

	Transform* transform = obj->GetComponent<Transform>();
	for (uint i = 0; i < transform->GetChildCount(); i++)
	{
		Instantiate( transform->GetChildAt(i)->GetGameObject(), layerRank );
	}
}