Hello, I am working on a script that will hide a sprite when the player is in a certain zone or not. i would like to know how can i acces the sprite and disable it (option A) or change the alpha color (option B) From a Script that is on player 1
Where you made the red circle, that’s actually not the light component but the gameobject. You can turn that off with gameObject.SetActive(false)
. If you want to turn off just the light and leave everything else on: GetComponent<Light>().enabled = false
.
To change the color: GetComponent<Light>().color = new Color32(255,255,255,0)
– as R G B A