how can i change Input.GetKeyDown to my created button?

Hi all.

I am beginner to unity and i have a question.

Here is my first script.
public class ItemA : MonoBehaviour
{

    public GameObject Player1;
    public Transform itemAtransform;
    public GameObject itemA;
    public GameObject itemB;

   
    void Start()
    {
        
    }

    
    void Update()
    {
        
    }


    public void OnTriggerStay2D(Collider2D other)
    {

        if (Input.GetKeyDown(KeyCode.E) && other.tag == "Player2")
        {
            other.gameObject.SetActive(false);
            Player1.SetActive(true);
            itemB.transform.position = itemA.transform.position;
            itemA.transform.position = itemAtransform.transform.position;

        }
    }
and other script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class itemB: MonoBehaviour
{

    public GameObject Player2;
    public Transform itemBtransfom;
    public GameObject itemB;
    public GameObject itemA;

    
    void Start()
    {

    }


    void Update()
    {


    }

    void OnTriggerStay2D(Collider2D other)
    {



        if (Input.GetKeyDown(KeyCode.E) && other.tag == "Player1")
        {

            other.gameObject.SetActive(false);
            Player2.SetActive(true);
            itemA.transform.position = itemB.transform.position;
            itemB.transform.position = itemBtransform.transform.position;


        }

    }

My question is how can i change Input.GetKeyDown(KeyCode.E) to my crated button? İ am trying to make a android game project. i pick up itemA and my player turn to Player1 or i pick up itemB my player turn to Player2. How can i change my player while press my created button my player on intriggerstay the item?
Thanks.

Sorry for my bad english.

Add event trigger to your button and replace Input.GetKeyDown(KeyCode.E) with eKeyIsPressed.
[158106-158100-captura-de-pantalla-19.png|158106]

bool eKeyIsPressed;
    
        public void GetKeyE()
        {
            if (eKeyIsPressed)
            {
                eKeyIsPressed = false;
            }
            else if (!eKeyIsPressed)
            {
                eKeyIsPressed = true;
            }
        }