the results are inaccurate the the first print function always prints 6 but the second one in the WaitAndPrint method outputs inconsistent values once it is 13.54 once it’s 13.4 . 13.38 and so on it never give a fixed value. And it is so essential to get the accurate distance the object moves in one second.
private float speed;
void Start(){
speed = 7.25f;
init();
}
public void init(){
print ("before"+transform.position.z);
StartCoroutine (WaitAndPrint ());
}
IEnumerator WaitAndPrint() {
yield return new WaitForSeconds(1f);
print ("after"+transform.position.z );
}
void Update() {
transform.Translate (Vector3.forward * Time.deltaTime * speed);
}