- Home /
Sprite alpha can't change during runtime
Hi, my Game Controller class have bunch of codes. I want to change my GameObject alpha property during runtime. Some parts of my code is below.
Brief of my code is here about changing alpha, I assigned these three game object from hierarchy, but not changing alpha.
.
.
.
public GameObject firstGO, secondGO, thirdGO;
float fullAlpha = 1.0f;
float halfAlpha = 0.5f;
public float firstAlpha, secondAlpha, thirdAlpha;
void Awake (){
firstAlpha = firstGO.renderer.material.color.a;
secondAlpha = secondGO.renderer.material.color.a;
thirdAlpha = thirdGO.renderer.material.color.a;
}
void Update(){
.
.
.
updateScore (100);
.
.
.
}
.
.
.
public int updateScore ( int length ){
.
.
.
firstAlpha = fullAlpha;
.
.
.
}
Comment