A* Path Finding (AI Destination Setter) Trying to set Target Transform to Nearest tagged Game Object (2D),

In the A* Path Finding script for the AI Destination Setter I am trying to use some form of neared Game Object script to set the target transform to the nearest tagged Game Object. I’ve looked all around for scripts to locate the neared tagged Game Object and even move to it but cant find anything to change the Target Transform in code. Any help would be appreciated. Thanks ,

to change target transform in code, you can use:

gameObject.GetComponent<AIDestinationSetter>().target = yourTransform;

Don’t forget to use library:

using Pathfinding;