I thought it was weird that the weapon range didnt take into account LOS and allowed you to see the range go through walls, even tho the shoot action cannot take those shots ever.
I did this by adding a final validation check on ShowGridPositionRange() in GridSystemVisual.
Remember to add the reference to the layer mask and assign this in editor
[SerializeField] private LayerMask obstaclesLayerMask;
Vector3 unitWorldPosition = LevelGrid.Instance.GetWorldPosition(gridPosition);
Vector3 testWorldPosition = LevelGrid.Instance.GetWorldPosition(testGridPosition);
Vector3 aimDir = (testWorldPosition - unitWorldPosition).normalized;
float unitShoulderHeight = 1.7f;
if (Physics.Raycast(
unitWorldPosition + Vector3.up *unitShoulderHeight,
aimDir,
Vector3.Distance(unitWorldPosition, testWorldPosition),
obstaclesLayerMask))
{
//line of sight blocked by obstacle
continue;
}