How do I make an Enemy attack after a trigger?

So I want my player to collide with an object and after that I want my enemy to start attacking and chasing the player. I have 2 scripts on my Enemy and the object I want the player to collide with.

Enemy Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyFollow : MonoBehaviour
{
    public GameObject player;
    public float speed;

    private float distance;
 

    // Start is called before the first frame update
    void Start()
    {
       
    }

    // Update is called once per frame
    void Update()
    {
        distance = Vector2.Distance(transform.position, player.transform.position);
        Vector2 direction = player.transform.position - transform.position;

        transform.position = Vector3.MoveTowards(this.transform.position, player.transform.position, speed * Time.deltaTime);

       
    }
     
}

Collision Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Colliding : MonoBehaviour
{
    public
    // Start is called before the first frame update
    void Start()
    {
       
    }

    // Update is called once per frame
    void Update()
    {

    }
       private void OnCollisonEnter2D(Collision2D collision)
      {
        if(collision.gameObject.CompareTag("Player"));
       
       
      }
   
}

I like this one-step-at-a-time approach. It works well with complex technical issues:

Imphenzia: How Did I Learn To Make Games:

If you run into trouble…

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • what actually happened, log output, variable values, and especially any errors you see
  • links to actual Unity3D documentation you used to cross-check your work (CRITICAL!!!)

The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven’t put effort into finding the documentation, why should we bother putting effort into replying?