Mesh has more materials (2) than subsets (1)

Working with Aras’ reflection script and all works well in the Editor. But when I play the game I get the error:

“Mesh has more materials (2) than subsets (1)”

Any ideas what might cause this or how to fix it?

you potentially added a material array to an object with 2 materials yet your model only has 1 mesh instead of 2 meshes that use distinct materials.

It definitely is using a material array (two materials on one object) - there is the ability to change the Material Size from 1 to 2. But that used to work in Unity 2.x. Has that changed?

Alrighty. Turned out it does work - as long as Static is turned off. I had baked the scene with Beast - and so had Static turned on. Once that was off, the Material Array worked fine.

Not sure about all the reasons why - but it works.

2 Likes

I encountered the same issue after creating a procedural mesh with 2 materials and saving it as a prefab. After adding the prefab to the scene and starting the application, Unity would give me the same warning. The inspector would show that my prefab had two materials but soon after starting the application it would be changed to 1 material by Unity and the warning would fire.

I fixed the issue by setting the Static option off, however I wonder if there’s a proper (or better way) to handle this warning without setting the Static option off. I made sure that my materials array was correctly initialized for the prefab, so I’m not sure why Unity gave me this warning.

Hi, I am getting this issue too. The problem being that its not economical to turn off the static flag for environmental objects. They wont move and there will be a large number of them.
Has anyone found a solution?

This seems to be caused by the material and the static batching property.
The question is simple… Why ?

The error occurs when you add more material on the object than IDs available and if you use the Static Batching in the Player Settings.
If I have a sphere divided in two IDs and so two materials, I have no problem. But if I add one more, I’ll get the error.

How can I avoid that using blend material over a whole object?

Bump. This is a strange issue, and turning “static” off doesn’t feel like a proper solution, especially since that can have performance implications etc… is there a real solution to this?

It seems “Batching Static” combines meshes together, and failed to match the second Material with other objects.
Canceling it will only increase the Draw Call.

Not sure if this clue is relevant but after adding any second material to an object without a mesh seems to flag the warning, as this is not impacting my runtime, i’m just going to ignore it for now, strange issue.

I have a shader that works over top of any material (blending the object material with terrain material) so I need this warning removed as I get like 60+ on start it’s cluttering my debugging!

Note this isn’t just some hacky thing I came up with out of nowhere This is the guy who made Microsplat. I’m using his component shader that does this… but I know this warning is just unity being unity has anyone found a solution for this? I’d like the option to mute it if I know for certain I don’t need it

Its works. Thanks