Set base color of a specific material

Hello, I have an object with script attached to it that changes the base color of the material. However, this model has multiple materials with different names. How do I affect just one of them? Is there a material.Find function I can use? Thank you.

1 Answer

1

Access renderer.sharedMaterials instead of renderer.sharedMaterial. Latter just returns the first, former returns all materials as an array, so you can access the one you want by index or go through all and find the one you want to change by name.