GUO unwalkable or walkable (4.1.1b)

I am having some problems with graphUpdateObject.

  1. A put a cube gameobject into my scene. Place half way into the ground. Disable mesh so invisible. Enable box collider. Set to trigger (so it wont stop anything walking through it).
  2. Set gameobject layer to “Water”.
  3. Create a node graph.
  4. Set collision testing mask to include “Water”.
  5. Set height testing mask to exclude “Water”.

I run the following code on the gameObject (go), a few seconds after the scene starts. However, the area of nodes remain un-walkable. I do see that the area refreshes when the code runs, but looks the same after.

Am I missing something? GUO should allow me to change a mapped area (in this case by collider bounds) to be walkable or un-walkable, or change the tags.

		var collider = go.GetComponent<BoxCollider>();
		_bounds = collider.bounds;

////

		Debug.Log(_bounds);
		
		GraphUpdateObject guo = new GraphUpdateObject(_bounds);
		guo.modifyWalkability = enableWalkability.Value;
		AstarPath.active.UpdateGraphs (guo);

I am going to bump this. Its a show stopper for me, until I can get it working. Sorry for so many questions!

Hi

The names of those fields are not optimal at the moment. It is easy to get confused.
There are 3 things one might want to do with regards to walkability with a GUO.

  1. Don’t do anything
  2. Mark all nodes as walkable
  3. Mark all nodes as unwalkable

Unfortunately booleans only have 2 options, and for some reason I didn’t use an enum when I designed it originally.
So the way to do it is:

  1. set guo.modifyWalkability = true. This will make it change the walkability instead of not doing anything.
  2. set guo.setWalkability = value. Together with the above option this will mark all nodes as walkable/unwalkable depending on ‘value’.

You probably also walk to set the guo.updatePhysics field to ‘false’. Otherwise it will also try to recalculate those nodes as if the graph had just been scanned (i.e checking for obstacles using the ‘Collision Testing’ options etc.).

See also

1 Like

Thanks, I think what I missed was that both I needed both modifyWalkability and setWalkability to be set to true.