Left / Right Button

using System.Threading;
using UnityEngine;
using Debug = UnityEngine.Debug;
using UnityEngine.SceneManagement;

public class PlayerMovement : MonoBehaviour
{

    public Rigidbody RB;
   
    public float forwardForce = 10f;
    public float sideForce = 1000f;

    // FixedUpdate when you use physics
    void FixedUpdate()
    {
        RB.AddForce(forwardForce, 0, 0 * Time.deltaTime); // Add a foward force

        if( Input.GetKey(KeyCode.LeftArrow) )
        {
            RB.AddForce(0, 0, sideForce * Time.deltaTime);
        }

        if( Input.GetKey(KeyCode.RightArrow) )
        {
            RB.AddForce(0, 0, -sideForce * Time.deltaTime);
        }

I have made this code that moves my player left/right using left arrow and right arrow and now i want to add support for mobile i was thinking of adding two button but since im new to unity i dont know how to do that. Can someone please help me?

Check this out dude Touch Input for Mobile Scripting - Unity Learn

Its not a simple reply to give you what you need. You will need some inheritance, special conditions etc. At least last time I looked.

Apart from that link, I would look up a tutorial on unity. Make sure you filter by a recent date though, as I said it does change from older versions.

Alright thanks

Using Lerp to smooth move

Vector3 pos;
GameObject objectToMove;
float Speed;
void Update()
{
    
      if(Input.GetKeyDown(KeyCode.LeftArrow))
      {
           pos = new Vector3(transform.position.x , transform.position.y , transform.position.z - 1.0f));
      }
      if(Input.GetKeyDown(KeyCode.RightArrow))
      {
         pos = new Vector3(transform.position.x , transform.position.y , transform.position.z + 1.0f));
      }
      objectToMove.transform.position = Vector3.Lerp(objectToMove.transform.position, pos, Speed * Time.deltaTime);
}