Support Forum

Patrol code examples?

I’ve been working on getting a super basic patrol ability working for my game. After browsing the documentation, I found out that there’s already a Patrol class that very well might already meet my needs. However, I’m using a custom pathfinding script and am not sure that the patrol script can accommodate it.

Are there any examples out there where I can use patrolling with a super basic custom pathfinding script like the custom movement script tutorial?


The Patrol script works on anything that implements the IAstarAI interface. You could make your custom movement script implement this interface. However, it is probably easier to just copy-paste the relevant bits from the Patrol script (it’s very short, only about 50 lines).