Alpha value not changing in Unity
Hey , I'm trying to change the alpha value of a sprite from 1 to 0. When I print my alpha value and see, it is changed but it is not reflected in my gameplay. Please refer my code below. No errors. The alpha value just doesn't change. I've also tried declaring a public spriterenderer and assigning the sprite to it and changing the alpha value but in all the ways, the alpha value changes but it is not reflected in the sprite in my gameplay. BTW, I have an animation attached to the gameobject. Will the animation cause any problem ?
private Color c;
void Start () {
c = GetComponent<SpriteRenderer>().color;
c.a = 0f;
GetComponent<SpriteRenderer>().color = c;
}
void Update () {
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612145629im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Changing Sprite won't work 0 Answers
[SOLVED] Sprite renderer does not render transparent parts of texture 1 Answer
Sprite change on click 0 Answers
Using a dynamic game object as a mask for another game object - Unity 2D 0 Answers
How can I switch animations while program is running on a game object? 1 Answer