Vector3.Distance Not Working in 2D game

So I am trying to return the distance between two GameObjects with the normal
float dist = Vector3.Distance(enemy.transform.position, transform.position);
However when I debug it is not updating the position each frame despite being in the Update Method. (Printing the same distance each frame despite the enemy moving)

  • I think the issue lies in the fact that I am making a 2d game possibly? I have checked and they are on the same order layer and sorting layer. Any other suggestions? I have tried everything I can possibly think of! I am thinking of remaking the game, I have never encountered this problem before!

Solution: I just realized what the solution was after posting the question. I dragged and dropped the prefab into the public variable. Silly mistake. Don’t be lazy! hard code everything!