Best Way To Setup a Waypoint-based Patrol System?
Throughout the past week, I've been experimenting with different systems of patrolling, each based off of simple waypoints (nodes) with no walls in between the ones meant to be traveled between for easy pathfinding (point him at the node and translate him forward). The problem arises when I want to connect nodes to each other. I've tried:
assigning them all by hand, giving each node a script with a public list that I then choose a size for and manually drag in each node the object can travel to from there but it was too tedious.
having an object parent to all the nodes linecast between every node and check for a wall, assigning a path between ones with no wall inbetween, but that method connected nodes when other nodes were inbetween them, not what I want.
having each node raycast and look for neighbor nodes within a radius of itself, but I realized I didn't want a length limit between nodes.
having the object raycast itself with a sight limit, but again, didn't want a limit
In the end, what I want is an easy way to connect and deconnect nodes from within the editor, in a way that lets scripts know which nodes can be traveled to from other nodes, possibly by adding them (by script) into a list contained within each node.
And if the way I'm doing this is below optimal, I'd also love an easier/better way. As long as the end product is a set of nodes scattered around a map that my object can travel between.
Edit: This question was obviously worded poorly, re-worded version here http://answers.unity3d.com/questions/1298313/connect-objects-for-scripts-to-use.html
Take a look at Behavior Designer. Thats what I use for patrolling/waypoints lots of stuff actually!! It's really cool. Also, I am not getting paid to advertise this. :D
Thanks, but this is a small, personal project I'm working on with a very simple pathfinding AI, and I'm not ready to spend $75 on it! XD I just need a quick and easy way to connect some objects together in a way that's meaningful to C#.
I'll keep it in $$anonymous$$d if I'm ever working on something bigger and need more control over my AIs :P
I saw this on the asset store a few days ago. It's priced more reasonably for a small project I$$anonymous$$O. https://www.assetstore.unity3d.com/en/#!/content/2506 it's $15
Have you tried Waypoint Pro 2D, Simply A* or RAIN AI for Unity (all are free assets)?
There are more assets in the asset store that cost
Here is a list sorted by price (cheapest that costs is $4.99).
Sorry, I don't think I was very clear in my question; I don't need a pathfinding AI, just a way to connect nodes together in a way that is meaningful for C#. Re-asked the question here: http://answers.unity3d.com/questions/1298313/connect-objects-for-scripts-to-use.html
Hope I worded it better.
you are clear about what you want, but it is tedious, because there is no algorithm behind this they could be coded. you could however write an editor script that makes it possible to select and drag gameobjects in the scene onto each other directly to connect them. our select all desired ones, then hit a coded button to choose to which other node they should connect.
Your answer
![](https://koobas.hobune.stream/wayback/20220612104708im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Help! Pathfinding 1 Answer
Can you use a character controller in a coroutine? 0 Answers
AI Waypoint does not loop 1 Answer
How to rotate object through waypoints on a curved path on sphere 1 Answer