I am running into an issue where I set the variable lastDistance But the value is then set to 0;
var curDistance=Vector3.Distance(destination,this.transform.position);
if(curDistance>lastDistance){
//Other code
}else{
lastDistance=curDistance;
Debug.Log(curDistance)); //returns 0.996
Debug.Log(lastDistance); //returns 0
}
Even though I JUST set lastDistance = to curDistance it has a different result. I assume I am missing something basic and fundamental, but I just can’t figure it out. I have also tried setting lastDistance = to the Vector3.Distance function, with the same result