- A* version: 5.3.3
- Unity version: 2022.3.58
Hi,
I’m wondering what the correct/best way is to update a NavMesh graph node’s connection cost at runtime would be?
I have certain sections of my nav that can be toggled to be blocked in one direction only at runtime. Since these points on the nav will not move, I was baking the node/connection lookup at build time, and at runtime I lookup those nodes/connections and update the Connection.cost property.
This worked in the 4.2 beta branch, but after upgrading to the latest 5.3.3 version, updating the connection costs in this way does not seem to take affect (my agents still follow the path as if the cost was the original cost).
Should the agents, the next time they calculate their path, see this new connection cost and take it into account when determining their path? Or is there some other method I need to call before agents will “see” this updated cost?
If I did not care about the directionality of the path, I could set the Node.penalty, and this does seem to still work. The agents see the updated penalty at runtime after I change it and correctly choose a different path that doesnt run through those nodes. But updating the connection costs does not seem to take affect.
This is essentially what I’m doing at runtime
graphNode.connections[i].cost = penaltyCost;
Thanks for the help