LayeredGridGraph Height Penalty Problem (And Fix)

Version: 4.1.8

I’ve noticed my height penalty stopped working a while ago on my LayeredGridGraph.

Dug into it today and saw a problem in LayerGridGraphGenerator.cs

It tries to set the height penalty at Line 568, but the position hasn’t been set yet. The node position is always (0,0,0), and doesnt get set until a few lines later: ‘node.position = (Int3)lln.position;’

I just moved the setting of the node position above the penalty calculation. Seems to work now.

I think this problem was introduced in a refactoring for Version 4.0.6

Hi

Thanks for reporting this!