How can I find a model's expected material indexes?

So if I export a blender object (obj in this case. fbx works too), I can run it through asset importer to get the resulting .mdl + materials/textures. In my case, I’m not using textures. In Urho, I do the following to set the materials to the write index:

roadObject.model = cache:GetResource("Model", "Models/roadSeg.mdl")
roadObject:SetMaterial(3,cache:GetResource("Material", "Materials/Road.xml"))
roadObject:SetMaterial(4,cache:GetResource("Material", 

and so on and so on.

Some of the objects could have 20 indexes. The thing is, any change to the object reorders these. And they are seemingly randomly ordered. So I am playing a guessing game for each model to figure out where the materials go. This is strictly just flat-shaded color materials assigned in blender, no uv wrapping or anything.

Maybe this is just a blender thing…I took a look at the .obj and .mtl in a text editor but didn’t see anything standing out. Is there a way to figure out the index expectation without guessing? I mean, it works, but there’s got to be a simpler way.

In edit mode, select all faces and pick Mesh -> Sort Elements… -> Material.

Thanks again, @codingmonkey. :slightly_smiling_face: