Issues when restarting formations


Active member
Hello, in this video I show 2 issues happening when restarting - or rather trying to restart formation tasks. I'm only trying to use a tree with just the Grid task in it.

Here is the error when "Restart When Complete" is set to true :

[Exception] ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.Collections.Generic.List`1[T].set_Item() at <51fded79cd284d4d911c5949aff4cb21>:0

FormationGroup.UpdateMoveStatus() at /Behavior Designer Formations/Scripts/Tasks/FormationGroup.cs:280
 279:  if (leader.Value == null) {
--> 280:      moveStatus[index] = status;
 281:  } else {
 282:      leaderMoveStatus = status;

Behavior.SendEvent[T,U]() at <90551af678e744f281eb5fcd0aa81afc>:0

FormationGroup.OnUpdate() at /Behavior Designer Formations/Scripts/Tasks/FormationGroup.cs:443
 442:  if (leaderTree != null) {
--> 443:      leaderTree.SendEvent("UpdateMoveStatus", formationIndex, currentMoveStatus);
 444:  }
 445:  prevMoveStatus = currentMoveStatus;

BehaviorManager.RunTask() at <90551af678e744f281eb5fcd0aa81afc>:0

BehaviorManager.Tick() at <90551af678e744f281eb5fcd0aa81afc>:0

BehaviorManager.Tick() at <90551af678e744f281eb5fcd0aa81afc>:0

BehaviorManager.Update() at <90551af678e744f281eb5fcd0aa81afc>:0

And I couldn't show it very well here, but there is some needless agent position reorganization when using this task again. AndrewGame has a gif that shows it clearly, I'll let him share it below. Could preventing needless reorganizations and keeping the current shape of the group be a possible feature request ? Thanks.
Hi, here is the GIF.
The problem I met was:
1. I cant find a task is specific for formation move.
2. If I use formation task for example Grid, every time you call it, it will reorganize the formation.
3. From my understanding, the reorganizing does not follow by a certain algorithm, its kind of random. Randomly assign each agent to a specific formation point. That cause some unnecessary reorganizing.


  • Formation.gif
    755.4 KB · Views: 3
The order is determined by the timing of when the follower task started. This is something that I'd like to improve upon. With that said, I won't be able to get to it until the DOTS version of Behavior Designer is released.