I did some testing a new project, and here's my findings with how things work:
Raycast Disabled:
Enemy immediately detects and charges toward target behind wall (as expected).
Raycast Enabled:
Enemy starts to wander toward his first waypoint (random).
After a bit of time (doesn't have to reach the waypoint) he will detect the player behind the wall and charge at him. After the Target Lost Interval expires, he will lose the player target, and never* detect it again. Importantly, if I then manually move the enemy on the other side of the wall so that the player is no longer blocked, the enemy still won't hunt the player. But if I put him within attacking range he will begin to attack him.
Furthermore, if I enable Raycast but remove the wall, the enemy will try to get to the player, and if I manually keep the enemy away from the player until Target Lost Interval expires, the enemy will lose the player target and never* again hunt the player. Without the Raycast enabled, the enemy will never lose the target even if I manually keep them away from each other.
To me this suggests that:
- The Raycast is going through the wall in call cases.
- After initial detection, Raycasts are no longer fired (or maybe there's a REALLY long delay between them, something along those lines).
(*I'm not sure if 'never' is true, but in my tests it didn't seem to anyway.)
If whatever is causing this is obvious in the code, great. If not, I can send a test project. Let me know :)