使用vector3.forward的时候X轴和Y轴也会跟着移动
public float Speed = 10;
private float Zend = -20;
void Start () {
}
void Update () {
if (transform.position.z<Zend)
{
transform.Translate(Vector3.forward * Speed * Time.deltaTime);
}
}