Sup everyone,
I have a loading screen in my game which I want to fade out when I tell it to. I started by making an object for which I attached a material. I changed the rendering mode to fade and by changing the alpha in the Albedo section I can get a variable alpha manually.
My question comes to changing it in the code. I’ve been doing the following:
public Material myMaterial;
public float alphaChange = 255;
void Update()
{
alphaChange -= 50;
if (alphaChange < 0)
{
alphaChange = 0
}
myMaterial.color = new Color(0, 0, 0, alphaChange);
}
This has not worked at all. How am I supposed to change the alpha?