Ao clicar no botão touch no Android, preciso que seja a mesma tecla correspondente no teclado físico do desktop

Hi everyone, please help me: I know Unity, 3Dmax, animations and modeling among others, but when it arrives in the programming part, the business gets complicated and the reasoning gets out of control. The problem: I modeled a character, I did the animation in Max with Biped, I took it to Unity so that’s fine. The animation only has two stages “walk” and “to” I used the Animator Controller, got round and working on the physical keyboard with the arrow keys or “W, S, A and D”. Now the headache starts, I need this to work on Android, WITHOUT LOSING THE FUNCTIONALITY OF THE KEYS, SINCE I’VE ALREADY EXIT A SCRIPT THAT MANAGES THE MOVEMENTS REPRODUCED BY THE ACTION OF THE KEYBOARD. I would just like the TOUCH buttons on Android to play or simulate pressing the “W, S, A and D” key. I know that each key has a code and the output would be there, when I pressed the touch button for the “W” key for example, it would be like I was actually pressing the “W” key of the real keyboard. I would like the blessed to instruct me how to accomplish this feat for me in a clear way, because as I said I’m weak in programming, I even tried to associate in some ways here like for example “EventSystem”, but, nothing worked. Thank you very much.

1- Attach the following Holdable.cs script to your UI buttons

using UnityEngine;
using UnityEngine.EventSystems;
 
public class HoldableButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
    public bool IsPressed
    {
        get ; private set;
    }
    
    
    public void OnPointerDown(PointerEventData eventData)
    {
         IsPressed = true;
    }
     
    public void OnPointerUp(PointerEventData eventData)
    {
        IsPressed = false;
    }

}

2- In your movement code, add references to those buttons and drag & drop the buttons in the inspector

 public HoldableButton ForwardButton;
 public HoldableButton BackButton;
 public HoldableButton LeftButton;
 public HoldableButton RightButton;

3- Change your conditions to check if the buttons are held down, along with your keyboard checks

void Update()
{
    // ....

    if( Input.GetKey( KeyCode.W ) || ForwardButton.IsPressed )
    {
          // Go forward
    }

    // Do the same for the other keys

}

Hi, the script you suggested worked perfectly: when the buttons are pressed on smartPhone (android).
But I can not make Player movements happen on the android just like they happen on the Desktop.
I tried to continue your script by adding some lines I got on the internet.
Example:

using UnityEngine;
using UnityEngine.EventSystems;

public class HoldableButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler



{
    public HoldableButton ForwardButton;
    //public HoldableButton BackButton;
    public HoldableButton LeftButton;
    public HoldableButton RightButton;

    private Animator PlayerAnimator;
       void Start()
       {
           PlayerAnimator = GetComponent<Animator>();
       }
   

    public bool IsPressed
    {
        get; private set;
    }


    public void OnPointerDown(PointerEventData eventData)
    {
        IsPressed = true;
    }

    public void OnPointerUp(PointerEventData eventData)
    {
        IsPressed = false;

    }

    void Update()
    {
        // ....

        if (Input.GetKey(KeyCode.W) || FrenteButton.IsPressed)
           // if (Input.GetKey(KeyCode.W))
            {
                //Debug.Log("a tecla W foi pressionada");
                PlayerAnimator.Play("Take_walk");
            }


        if (Input.GetKey(KeyCode.A) || FrenteButton.IsPressed)
            //if (Input.GetKey(KeyCode.W))
            {
                //Debug.Log("a tecla A foi pressionada");
                PlayerAnimator.Play("Take_walk");
            }

        if (Input.GetKey(KeyCode.D) || FrenteButton.IsPressed)
           // if (Input.GetKey(KeyCode.W))
            {
                //Debug.Log("a tecla A foi pressionada");
                PlayerAnimator.Play("Take_walk");
            }

        // Do the same for the other keys

    }
}

But I have no idea what I did, just intuition, the truth was that nothing worked. I need the touch buttons on android, call the Player animation, just like it happens in the descktop.
Just below I put the script that is attached to Play and manages the movements of the Player. Once again thank you immensely.

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

[RequireComponent(typeof(Animator))] //Obriga o componente do Animator

public class ControlePlayer : MonoBehaviour
{

    private string turnInputAxis = "Horizontal";

    private Animator anim; //Declarando o animator como uma variável

    [Tooltip("Rate per seconds holding down input")]
    public float rotationRate = 360; //Valor para velocidade da rotação do player


    void Start()
    {
        anim = GetComponent<Animator>(); //Atribuindo o componente a variável na inicialização
    }


    void Update()
    {
        float turnAxis = Input.GetAxis(turnInputAxis);

        ApplyInput(turnAxis);

        float inputX = Input.GetAxis("Horizontal"); //Capturando os imputs do eixo Horizontal e atribuindo para a variável inputX
        float inputY = Input.GetAxis("Vertical"); //Capturando os imputs do eixo Vertical e atribuindo para a variável inputY

        anim.SetFloat("Horizontal", inputX); //Atribui o valor da variável inputX para o parâmetro Horizontal do controle de animação
        anim.SetFloat("Vertical", inputY); //Atribui o valor da variável inputY para o parâmetro Vertical do controle de animação
    

        //Correndo ou não

      /*  if (Input.GetKey(KeyCode.LeftShift))
        {
            anim.SetBool("Run", true); //Segurando o shift esquerdo a bool Run do controle de animação recebe true
        }
        else
        {
            anim.SetBool("Run", false); //Soltando o shift esquerdo a bool Run do controle de animação recebe false
        }*/
    }


    void ApplyInput(float turnInput)
    {
        Turn(turnInput);
    }