Move (and other actions) multiple characters 1 at a time?

Okay, so, I cannot quite figure this out. The concept is, I want to have multiple characters, give one orders, it will then execute those orders and the camera will follow it, and then the game will move on to the next character. (If you’ve ever played any turn-based tactical rpg such as Fire Emblem or Final Fantasy Tactics or something - basically, like that).

For example, let’s say I have some AI player that has a reference to all its units, then I’d want to do something like

public Unit[] myUnits;

void GiveOrders(){
 foreach(Unit u in myUnits){
  //Do something to determine what unit should do,specifics dont really matter here
  //Order is some kind of class that contains an order for a unit that it can execute
  Order order = new Order(walkHere, attackTarget);
  //Now I want to wait until this unit is done with its 
  //orders before I move on to the next one... somehow

and in Unit I suppose there would be something like

bool ordersCompleted;
NavMeshAgent agent;

public void ExecuteOrder(Order order){
 //walk first then attack. Should probably put something in Order that tells 
 //if it should walk then attack or attack then walk, but again not 
 //really relevant here
 //Again here should wait until action is completed
 //and again wait until action is completed
 //then do something that tells the AI that all orders are executed
 //and this unit is done
 ordersCompleted = true;

void Attack(Unit enemy){
  //Some kind of attack method would be here

I’m fairly sure I should do something with coroutines here, but I am not getting them right :frowning:

So in other words what I want to do is ‘begin action A → action A calls action B → put action A on hold, do action B → B is completed → continue with A’.

Ok, I figured this one out, turns out coroutines were not the way to go… (at least, my solution doesn’t use any)

it sort of goes like this:

in AI class:

Unit[] myUnits;
int currentlyExecturing;

 //call this when this AI player's turn starts
  public void StartTurn(){
                //start at unit 0
    		currentlyExecuting = 0;

void Update(){
    //check if current unit orders are completed each frame
            //if so, give orders to the next unit or end turn if it was the last unit
		if(currentlyExecuting < myUnits.Length-1){

//Give order fucntion
void GiveOrder(){
    Order o = new Order();
    //should do something to determine what the order 
    //actually is

And in unit:

bool ordersCompleted;

void ExecuteOrder(Order orders){
  ordersCompleted = false;

  walking = true;

void Update(){
 if(walking) Walk()

void Walk(){
if(agent.remainingDistance <= agent.stoppingDistance){
 walking = false;
 ordersCompleted = true;


Haven;t incorporated any attack action yet so these agents just do walking, but they do it sequentially which is what I wanted. So I’ll mark this question as answered, but if anyone has a better way of doing this, I’d love to hear it.