I know that I can make a material for an object invisible by using:
gameObject.renderer.material.color.a = 0;
But this makes the material invisible for this object only. I use the same material on multiple objects, and I want them all to be invisible. How would I do that?
To clarify: I have a character with multiple parts, some of which are weapons that are made visible via ‘renderer.enabled’ separately, one at a time. If the player’s health reaches 0, I want him to become invisible for a short amount of time (to make him explode via particles and rebuild him after some time). I use the same material for all parts of the character, and for nothing else, so I thought it would be the most practical way to make him invisible.