So my enemies have a box collider that tells them when a player has entered the aggro range
problem is the collider goes through the wall because is trigger must be on to work correctly with
the attached script and causes them to walk into walls after the player
what is some methods you could theoretically use to prevent this from occuring?
You can use the trigger to detect the wall and stop the enemy with a script.
You can have the trigger on an object, and notify the enemies when the player has entered, then they can have collision.
You can have two colliders on the enemy, one for trigger and one for collision, but they might need to be stacked or something.
What’s most common, though, is to do a distance check to the player.
Collider detects player is in range or a distance check(trigger might be more efficient need to do more testing).
Enemy then starts performing Raycasts to check for LOS, put this in a coroutine or other timed check as long as player is in range to keep polling LOS. Timed as it doesn’t need to happen every update, adjust timing to your liking.