RTS units team

Hi programmers,

How could I implement that each enemy is checking each other enemy by distance (multiple gameobjects) when the leader has reached it’s target and then basically what I need is that it reforms itself to a team.

Thanks,

HelloIam41

  1. Make the units to share the same squadID to know which units are together.
  2. When you select desired moce position set it in a property.
  3. Add a trigger to the units (read a tutorial how to make triggers) and when the trigger fires reset the property above and after that regroup the units around this point.

(if you have a leader unit then you may add the trigger only to the leader)

That is not what I need what I have is that one leader is moving to my mouse position and the others are following him so when they follow him and I do a distance check between the team and the leader they will all stop at the same position. What I need is that they check each other and reform themself as a square when they reached their destination instead of stopping at the same position or jumping on each other.

HelloIam41