PLEASE HELP WITH ANIMATION!!!!!!!!

hi
OK I HAVE BEEN STRUGGLING TO GET THIS THING WORKING FOR 4 DAYS!!!
It does nothing.
I have watched multiple tutorials, looked at the manuel but it still doesn’t work.
Can someone explain me what i am doing wrong since i am scrathing my flippin head off.

What i try to achieve is I have a UI Image that changes opacity after i get in contact with “Ground [UNREACHABLE]”. I used the animator, made 2 bool paramaters: isIdle (Invisible) and isFading (fades in).
The script is attached to the player and the UI Image itself. And if that isn’t bad enough, appearantly there is a stupid bug that happens every now and then and it says that my parameters don’t exist??? I am pretty bad at coding so i appriciate all the help i can get.

The script i am using (c#):

using UnityEngine;
using System.Collections;

public class Screen_Fade : MonoBehaviour
{
public Animator anim;

void Start()
{
    anim = GetComponent<Animator>();

    anim.SetBool("isFading", false);
    anim.SetBool("isIdle", true);
}

void OnCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.name == "Ground [UNREACHABLE]")

    {
        anim.SetBool("isFading", true);
        anim.SetBool("isIdle", false);
    }
}

The script is attached to the player and the UI Image itself.

This is the problem. This script should be attached to the player gameObject since only him will receive the OnCollisionEnter2D event from the Physics engine.

But since you want to animate anoter gameObject, the simple solution is to declare the Animator public and drag & drop the image into the inspector.

public class UnreachableGroundDetector : MonoBehaviour
{
    // Drag & drop the gameObject that must be animated
    public Animator imageAnimator;
    
     void Start()
     {
         imageAnimator.SetBool("isFading", false);
         imageAnimator.SetBool("isIdle", true);
     }

     void OnCollisionEnter2D(Collision2D col)
     {
         if (col.gameObject.name == "Ground [UNREACHABLE]")
         {
             imageAnimator.SetBool("isFading", true);
             imageAnimator.SetBool("isIdle", false);
         }
     }
}