Pathfinding for 2D : Failed to Create Agent Because it's Not Close Enough to the NavMesh

Hi guys… so I was trying to make pathfinding 2D for my tower defense game… I found this awesome tutorial on youtube

This tutorial shows some tricks to make pathfinding on 2D. It uses cube position as an agent and the sprite position refer to it.
I have no idea how to instantiate both sprite and the agent(cube) to have the same position while they are child of the different parents.
And when I tried to instantiate the agent it gives me a warning “Failed to Create Agent Because it’s Not Close Enough to the NavMesh”, but I already matched the agent position to the instantiated object(agent)

Try using transform.localPosition instead of position, to position it relative to the parent instead of the world.

yes… I was using that but still the agent is failed to create