Detecting dead paths


I am making a TD. It’s pretty standard. Build your own maze. I have the pathing running fine aside from one major issue.
I can easily and pretty much cost free check if a path from start to finish is being blocked. I just have to test a single path from start to finish each time a tower is placed. If it fails then don’ allow them to place it.

Is there any easy way to do this for creeps as well so you can’t block them in? Since it’s a TD there will end up being quite a bit of creeps so looping through each one would get costly fast.


I think you want to check out this API:
That was created specially for this purpose.

okay so I looked it up and tried to implement a quick test, but I keep getting this error when ever it should return false.

NotSupportedException: Positions not supported yet

tower = GameObject.Instantiate(Resources.Load<GameObject>("prefabs/tower"), position, Quaternion.identity) as GameObject;

		GraphUpdateObject guo = new GraphUpdateObject(tower.collider.bounds);

		GraphNode n1 = Vector3(-8.5f, 0, 8.5f)).node;

		GraphNode n2 = Vector3(-0.5f, 0, 8.5f)).node;

		bool pathBlocked = pthfinding.GraphUpdateUtilities.UpdateGraphsNoBlock (guo, n1, n2, false); 


The image below shows me carving a path from top down to the left, returns true until I block the path on the edge at which point it gives the error instead of returning false.


oh, sorry. That was a limitation it had in the beta. I have just forgot to remove that limitation.

Here is the correct code for AstarClasses.cs -> GraphUpdateObject.RevertFromBackup

public virtual void RevertFromBackup () {
if (trackChangedNodes) {
if (changedNodes == null) return;

	for (int i=0;i<changedNodes.Count;i++) {
		changedNodes[i].Penalty = (uint)(backupData[i]>>32);
		changedNodes[i].Flags = (uint)(backupData[i] & 0xFFFFFFFF);
		changedNodes[i].position = backupPositionData[i];
	ListPool<GraphNode>.Release (changedNodes);
	changedNodes = null;
	backupData = null;
	backupPositionData = null;
} else {
	throw new System.InvalidOperationException ("Changed nodes have not been tracked, cannot revert from backup");


comment removed (was a question starting new question to close this one)

alright so I thought it was working correctly, but I am having an issue with it. It doesn’t seem to want to revert back unless it’s within a range from it. So the creeps just stay still (can’t reach their destination) until I place a tower near the blocked area.

First off in settings I do have
Min Area Size = 0
Max Update Frequency = 0

my code looks like this

This code is only called when a click is performed.

tower = GameObject.Instantiate(Resources.Load(“prefabs/tower”), position, Quaternion.identity) as GameObject;
GraphUpdateObject guo = new GraphUpdateObject(tower.collider.bounds);
List nodes = new List(AStarAI.creepOnNode.Values);

	nodes.Add( Vector3(-8.5f, 0, 8.5f)).node);

	bool pathBlocked = Pathfinding.GraphUpdateUtilities.UpdateGraphsNoBlock(guo, nodes, false);

	if (!pathBlocked)
	Debug.Log("UpdateGraphsNoBlock returned: " + pathBlocked);


to better understand the issue I made a video showing what happens.