I'm trying to change a material alpha colour on runtime, but it isn't working.
Here is my script that changes the colour:
public Material materialCol;
public Color color;
void Start()
{
color.a = PlayerTalents.talents_.sight;
materialCol.SetColor("_Color",color);
}
"color" is just white with alpha set to max
Here is the material setup:
Here is what it looks like in-game:
Here are the material properties of albedo in-game:
CodePudding user response:
Make sure the value of PlayerTalents.talents_.sight
is between 0 and 1f.
I've tested the code, this works:
using UnityEngine;
public class AlphaTest : MonoBehaviour
{
public Material materialCol;
public Color color;
void Start()
{
color.a = 0.7f;
materialCol.SetColor("_Color", color);
}
}