Hey, everyone! This is my first question on the Unity Forums!
So, I have a NavMeshAgent attached to a player-controlled unit. When the player clicks a valid target, the unit moves towards that target on the NavMesh. However, if I try to give it a target on the other side of an obstacle, the agent just goes right through it! I’ve messed with colliders, rigidbodies, and isKinematic, but to no avail.
You need to add a nav mesh obstacle component to your non-static objects.
On The Obstacle Add NavMesh Obstacle Component Now Choose Desired Shape For Obstacle , I would Suggest To use Box , Now Adjust The Size So That the It Covers Your Obstacle Object , For Now To Test Just Use Value Of 2 In all X,Y,Z And Enable The Carve Option . Now In The Scene You Can Try To Move Your Obstacle And You Will See The NavMesh Around The Obstacle Gets Modified . Now Play the Scene And Give Target to Your Player And in Scene View bring The Obstacle In front Of Player . now It Will Not Go Through The Obstacle but Will Find New Path . Again For Fun You can Move Obstacle In front Of Player And Player Will Find New Way to Reach The Target . have Fun