left and right buttons for android 2d game

i used this code to allow my player to move left and right but i don’t know how to include the codes for buttons…i’m just a beginner at this…i would like to credit “gucio devs” since the code i got was from his tutorial…thanks please reply asap :slight_smile:

using UnityEngine;
using System.Collections;

public class Touch : MonoBehaviour {
	public float speed=5f;
	public bool grounded;
	private Rigidbody2D rb2d;
	// Use this for initialization
	void Start () {
		rb2d = gameObject.GetComponent<Rigidbody2D> ();
	// Update is called once per frame
	void Update () {
	void FixedUpdate()
		float h = Input.GetTouch ("Horizontal");
		rb2d.AddForce ((Vector2.right * speed) * h);

So, read the docs:

You’ll see that this API is intended for mobile devices. If you then look at:

you’ll see advice about how to manage input on PCs. Some of the APIs that you need on laptops/desktops have code examples that should get you sorted.