Question regarding sharedMaterial and AssetReference

Hello! I’m currently trying to change a material shared between multiple objects. Usually in my experience (in C#), changing a shared material color would change that material for all objects using it, however when I change it here it only changes that material on one object. I suspect this is due to needle potentially instantiating the material for each assetreference object using it, and so they are technically separate? Is there an easy fix for this, or should I just store the color value and manually change the values for that material for every object?

Original Post on Discord

by user 167254621973118978

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

Hey, from your description it sounds like you’re specifically trying to adjust a material that is shared between the different objects loaded using AssetReference?

Yes, however upon changing that material it only changes it for one object

by user 167254621973118978

That is correct. As an explanation in the “Unity world”, what AssetReferences basically do is similar to Addressables, where each of the “bundled” things comes with their own instances of materials

What you can do is postprocess them after loading to ensure they’re all using your shared materials

Multiple instances of the same AssetReference should already work like this

Alright, then yeah I have some potential solutions in mind. Thank you!

by user 167254621973118978

Great! I’ll take a note here to check how we want this to work, I can see this can be confusing in some cases