I am new to scripting, and i don’t know much of it. I need help with making a Auto-Moving script. I am making a endless runner, and i made a script that makes my player go forward as it press W, using rigidbody. But, how can i make a script that makes the player go forward even if he is not pressing any key? Like a Auto-move.
This is my script:
using UnityEngine;
using System.Collections;
public class goahead : MonoBehaviour
{
public float speed = 1f;
void Update()
{
transform.Translate(Vector3.forward * Input.GetAxis("Vertical") * Time.deltaTime * speed);
}
}