Title says it all, I’ve looked online for multiple solutions.
I’m instantiating a Prefab multiple times for my UI, I’m trying to set the child of this prefabs Image components Materials Colour (what a chain of words), and its resulting in them all being the same colour as the last one instantiated (I believe the entire material colour is being changed).
hair.material.SetColor("_HairColour", hairColour);
I have almost the exact same code working fine for my actual game objects using SpriteRenderers. It seems to be something with the Image component…
I’ve tried forcably making Clones of the material from the material & the shader like so, it does indeed make (Clone)'s but it still acts the same way in both cases…
GetComponent<Image>().material = Instantiate(GetComponent<Image>().material);
Material instance = new Material(shader);
instance.CopyPropertiesFromMaterial(material);
GetComponent<Image>().material = Instantiate(instance);
I’m at a loss here, so any assistance would be appreciated!