public class Movement : MonoBehaviour
{
public float moveSpeed = 10f;
void Update()
{
if (Input.GetKey(KeyCode.UpArrow))
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
}
}
I have been following the tutorial that teaches how to rotate and move gameobjects, and it has gotten to the point where you make the object move when a key is pressed. If I remove the if(Input.GetKey… code, it will fly away on its own. However when I add it the object does nothing, even if I press the uparrow. The same input code has worked for projects in the past.