how do I make a button spawn an enemy

I am working on an assignment for a course and I need to have this working.

Create the button on the Canvas and a script that will contain the code:

public class ButtonInstantiating : MonoBehaviour
{

    public GameObject enemyPrefab;
    public Transform spawnPoint;

    // Make sure to set this method as public!
    public void ButtonPressed()
    {
        // Your instantiate code here
        Instantiate(enemyPrefab, spawnPoint);
    }
}

Assign this script to a GameObject present in the scene, then on the Button component of the button you want the user clicks on it for spawning enemies assign the function “ButtonPressed” to the OnClick event as above:
134357-untitled.png

And you’ve done!