Unity materials problem

I’m having some trouble exporting materials to Unity. I have several objects, each of which has the same 2 materials. When I import the object into unity some of the materials from slot 1 are in slot 1, and some are in slot 0. This is a problem since I’m assigning materials through script.

Also, is there a way to get rid of all material data in a blend file?

Figured it out. It’s kind of an obscure problem, but it’s not limited to Blender users. Unity assigns materials according to the face order in the mesh, not the material order. To fix this, you need to find the affected object, go to edit mode, select all (face mode) and sort mesh elements by material (use the spacebar to find it).