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
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);
}
}