Image Pop Up,Fade in and Fade out OnTrigger
Hi!
I'm a very basic user of Unity, and I have a little question, I want to make an image pop up when a FSP hit a sphere, I have a code that already does that (I found a YouTube tutorial... it help!) my question is: how can I make the image fade in and fade out when the FSP enter and exit the trigger?
If someone can help me, I'd be very gratefull! I leave the code I have:
public class UIappear : MonoBehaviour {
[SerializeField] private Image Image;
void OnTriggerEnter (Collider other){
if (other.CompareTag ("Player")) {
Image.enabled = true;
}
}
void OnTriggerExit (Collider other){
if (other.CompareTag ("Player")) {
Image.enabled = false;
}
}
}
Thanks!
Comment
Your answer
Follow this Question
Related Questions
How can i activate a script on a character when entering in a trigger zone ? 1 Answer
Player under Canvas Image 1 Answer
Trigger is not detecting tag 2 Answers
player trigger ball falls 1 Answer
Help on how to code crouching? 0 Answers