Hi, I’m making a game and I’m stuck on this for ages. How to make the player move in a certain direction without user input. Please, could you help me I’m new to Unity?
If you want your player to move without user input like in Subway Surfers or other runners you can try using Tranlate
Here is an example
public float speed = 10f;
private Vector3 dir;
void Start(){
dir = Vector3.forward; //Vector3(0, 0, 1)
}
void Update(){
float amountToMove = speed * Time.deltaTime;
transform.Translate (dir * amountToMove);
}
For more information about Transform.Translate
and others check Unity Scripting Reference