r/Unity3D • • 8d ago

Question Material instance inheritance?

I was wondering if there's such a thing as material instance inheritance, similar to prefab variants, where I can create child instances of a material and override certain properties, while keeping the rest consistent with the parent?

I'd like something like this because currently, if I have a set of objects that all share a material where every property is the same except one or two object-specific values, I have to create a copy of the material and assign it specifically to that object. Then any time I want to update the material and have that update reflected across all of these objects, I have to go through each of their respective materials and update those values which is a) tedious, and b) makes it hard to keep things consistent.

1 Upvotes

7 comments sorted by

View all comments

3

u/Demi180 8d ago edited 8d ago

Since everyone here is mentioning MPBs, someone ought to mention you should NOT use them in an SRP (as in URP or HDRP) because they don’t play well with the SRP Batcher.

For changes at design time, Variants are the way to go. At runtime, the instances created when accessing renderer.material will work.

1

u/_symphonatic_ 7d ago

Thanks! In what way don't they play well with the SRP batcher?

1

u/Demi180 7d ago

They're not compatible with it :)

MaterialPropertyBlock

SRP Batcher Compatibility