Normally you assign materials like this:

StaticModel* boxObject=boxNode_->CreateComponent<StaticModel>();

You can also load materials, copy them, and/or change parameters:

Material* mat1=cache->GetResource<Material>("Materials/Stone.xml");
Material* mat2=mat1->Clone();    // copy material
// change the ciffuse color

You can use this to make every model unique by randomizing colors or color models in a team color. You can also pass custom parameters to control things like current weather or different (localized) lighting scenes.

An example of 400 uniquely colored cubes:

Copy material

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.