Follow Order
public sealed class FollowOrder : Order
Use this order in situations when a unit should follow another unit. To set up a FollowOrder, pass the unit to follow into its constructor (or the FollowTarget field of the class instance).
Example
// this example code running from Unit.cs component
Unit unit = this; // getting the unit component from which we run this code.
Unit otherUnit = FindAnyObjectByType<Unit>(); // suppose that here we are setting up the Unit component of another unit.
FollowOrder order = new FollowOrder(otherUnit); // creating new FollowOrder here, with the other unit as its follow target.
unit.AI.AddOrder(order, false); // adding the created order to the unit's orders list. Now the unit will follow the other unit.