Array of Targets

How can I make multiple targets? Like after I go to TargetA, i will go to the next target which is TargetB.

What code are you using?

If you’re using AILerp, and maybe others, you could do something like this:

public class YourAI : AILerp {

    public Vector3[] targets;
    private int index = 0;

    void Start() {
        target = targets[index];
    }

    protected void override OnTargetReached() {
        index++;
        target = targets[index];
    }
}

That should work, but it may not be perfect; I’m posting from mobile :wink:

1 Like

Currently using the AIPath.cs. I just need to change it like this?
public class AIPath : AILerp Thanks! :slight_smile:

No, @drinfernoo was suggesting that you make a subclass of the AILerp class and add that logic there. You could use the same approach for the AIPath script however.

I am trying to implement something like this,but I’m having some problems. My code is here, and I’m having some weird jittery movement, as well as stopping after a couple cycles. That can be seen here. Have I set up my Seeker or something wrong?

EDIT: I think it may actually have to do with that UpdateGraph() method :confused: