finding closest object and moving enemy to it

Hi i just need a little help with some C# code.
i have multiple cubes placed around my world and a player that can move and look around.
i need to move my enemy to the cube that my player is closest to.
i have googled my butt off but nothing. could someone help me! I’m loosing hooopppeeee!!!
butt anything would be helpful.

all i have is an array with all my cubes

How about comparing the distance between the enemy and every qube in the array? Remember the index of the lowest so far.
Then you know what qube is the closest.

so that is what i have been seeing everywhere… i guess what I’m asking is how do i single out
the block that the player is closest to so i can move the enemy. if you can understand that

so i have an array with multiple cubes in it. in my scene i have an empty game object with all my cubes in it
when i put my empty game object called nodes in the target position in the inspector the script looks for the
empty game object not the cubes so how do i get it to find the distance from my player to the cubes