I must be missing something obvious here, but here’s my code
distance = (closest.transform.position.y - transform.position.y);
Mathf.Abs(distance);
if (distance < enemyDetectRange) {
moveVertical = 1f;
if (distance < 20) {
if(withinAttackX == true)
{
Debug.Log ("VILLAGER IN RANGE");
Debug.Log(distance);
Some how the console is still showing distance with negative numbers, which makes no sense as I thought Mathf.Abs(distance) would always make it positive?