Material Property Blocks with Mesh Renderers that have multiple materials

I am trying to set different MaterialPropertyBlocks for a MeshRenderer that has 2 material. But as far as I know, this is not possible, since you get the MaterialPropertyBlock from the renderer, and you cannot choose which material to apply the property block to.
Is there a way to solve or work-around this? thanks!

Use two renderers. Either split the mesh or leave one material in the renderer’s materials array null.

problem is this is Ferr2D, I cannot set 2 renderers… I asked in their thread also.

1 Like

This popped when I was looking for a way to do the exact same thing.

As per now, theres a version of the Renderer.SetPropertyBlock that allows you to specify the material index.

Don’t know if it was available last year.

10 Likes

How do you know which material is which index?

Check it in editor
9453575--1327454--upload_2023-11-6_21-32-49.png

1 Like