At least on my tests it seems like generated SpeedTrees that are part of the terrain are not detected by the collider when building my graph, regardless of them being on the ground layer or on default layer. If I take a speedtree and drag it to the scene, then it is detected. Is this not supported by A*?
What I find odd is that A* can detect ground elevations that block the collider just fine, so it’s beyond me why speedtrees shouldn’t be working fine, regardless of what layer they’re on.
Expanding upon my post, here is a screenshot of the problem:
The tree to the left was dragged to editor as a prefab. Both it and the white capsule are on default layer and perfectly detected by the graph generator.
However the tree to the right is not being detected. It’s also on default layer thanks to the new terrain property “Preserve Tree Prototype Layers”. This really works, trees are on “default” layer as is proven by hiding the default layer, makes all trees disappear.
So, is there any reason why A* is raycasting through that terrain speedtree and ignoring it when drawing a graph?
I think this is a unity quirk/bug. If I remember correctly the Unity terrain system doesn’t generate tree colliders while in editor mode for some reason. I think it will pick them up if you scan the graph once the game is playing, could you try that?
One thing to note (which I learned through trial and error) is that AStarPath.active.Scan() will wipe out any custom connections made through AddConnection(), or node Walkability flags that may have been set during gameplay!
It really is meant as a “wipe clean” function, and should probably only be used when loading a level from a “stock” state.
I know this is a very old thread, but it’s all that I found when looking for speedtree detection on terrains using A*.
I’m having the same issue as the OP, with terrain trees using speedtree not detected by A*, except that even when I scan in play mode, it still doesn’t detect the trees. If I just drag the trees in as prefabs they work fine as well.
This is on Unity 2021.3.17, so I’m guessing something changed in Unity since the original thread. Is there anything I can do to have A* correctly detect my speedtrees on the terrain?
Edit: It works on the 4.3.61 beta but not on the 4.2.18 stable version. So I guess I’ll have to use the Beta.