[Beginner] About Canvas and Set.Active,[Beginner] About Set.Active and UI

I was searching for tutorials in regards to making a basic Interaction System with button prompt for a 2D game. After searching for a while I stumbled upon this tutorial: How To Interact With Objects [Unity Tutorial] - YouTube. It was quite helpful for me.
However, while I was able to make almost everything work I am a bit confused about the button prompt aspect.

This is the relevant code attached to my player

public GameObject interactIcon;
void Start()
    {
        interactIcon.SetActive(false);
    }
public void ShowInteractableIcon()
    {
        interactIcon.SetActive(true);
    }
    public void HideInteractableIcon()
    {
        interactIcon.SetActive(false);
    }

I have another script attached to my interactable objects and this is included:

 public void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision.CompareTag("Player"))
        {
            collision.GetComponent<PlayerController>().ShowInteractableIcon();
        }
    }

    public void OnTriggerExit2D(Collider2D collision)
    {
        collision.GetComponent<PlayerController>().HideInteractableIcon();
    }

I created a canvas using ScreenSpace-Camera and added a placeholder picture object as a child that I want to use as my interactIcon. I dragged it into the GameObject field of my player where my first script is attached to.

Now, just as the code demands, the icon is set to false at the start so I cant see it when I press play. However, once I move into the collision box of my interactable icons, I should see the icon because it is then set to activate correct? This however is not the case and I do not know why.

I have set the Player’s tag to player because I believe that’s the object that should have the player tag based on the code. Is that incorrect? Or is it a problem with my Canvas settings?

Or perhaps I have somewhat misunderstood this part of the code.

Here are the full two scripts, if those are needed.
First, attached to my Player Object (the pink Capsule):

public class PlayerController : MonoBehaviour
{
    public float speed = 5.0f;
    public float horizontalInput;
    public GameObject interactIcon;

    private Vector2 boxSize = new Vector2(0.1f, 0.1f);

    // Start is called before the first frame update
    void Start()
    {
        interactIcon.SetActive(false);
    }

    // Update is called once per frame
    void Update()
    {
        horizontalInput = Input.GetAxis("Horizontal");
        transform.Translate(Vector2.right * Time.deltaTime * speed * horizontalInput);

        if(Input.GetKeyDown(KeyCode.E))
        {
            CheckInteraction();
        }
    }

    public void ShowInteractableIcon()
    {
        interactIcon.SetActive(true);
    }
    public void HideInteractableIcon()
    {
        interactIcon.SetActive(false);
    }

    private void CheckInteraction()
    {
        RaycastHit2D[] hits = Physics2D.BoxCastAll(transform.position, boxSize, 0, Vector2.zero);

        if(hits.Length > 0)
        {
            foreach(RaycastHit2D rc in hits)
            {
                if(rc.transform.GetComponent<Interactable>())
                {
                    rc.transform.GetComponent<Interactable>().Interact();
                    return;
                }
            }
        }
    
    }
}

And then the script attached to my Interactable Object (the cube):

[RequireComponent(typeof(BoxCollider2D))] public abstract class Interactable : MonoBehaviour {
    private void Reset()
    {
        GetComponent<BoxCollider2D>().isTrigger
= true;
    }
    public abstract void Interact();

    public void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision.CompareTag("Player"))
        {
            collision.GetComponent<PlayerController>().ShowInteractableIcon();
        }
    }

    public void OnTriggerExit2D(Collider2D collision)
    {
        collision.GetComponent<PlayerController>().HideInteractableIcon();
    } }

I’m thankful for any help.

It seems to me that you are mixing up the UI with the Game. A Canvas should be use for UI purpose, while you should use SpriteRenderer for in game object. To the best of my knowledge, you cannot use collision detection(OnTriggerEnter, etc.) in a Canvas.

I have also tried using a 2D sprite set as a child of the player character but that did not work either. Same as when I tried using it as a child of the interactable object.
That is when I tried using Canvas.

Is that approach, aka setting it as a child of the player character, also wrong?