Node* boxNode = scene_->CreateChild("BoxInAir");
boxNode->SetPosition(Vector3(10, 10, 30));
StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneEnvMapSmall.xml"));
boxObject->SetCastShadows(true);
boxNode = scene_->GetChild("BoxInAir");
The above code, the boxnode is not same as what I create. I also create 900 bears (just testing performance), and it actually returns one bear.
Actually I did solve the problem. It was on the following thing:
for (unsigned int i = 0; i < NUM_MODELS; ++i)
{
Node* modelNode = scene_->CreateChild("Jack" + i);
Somehow the String cannot concatenate with integers, but it gave me no errors. On the otherhand it seems to add some very cryptic names, like materias names, etc. Also I couldn’t find something to turn integers into Urho3D::Strings.