Next thing to do is to add a Collider component to the main building object with “Is Trigger” set to true. This Collider represents the frontiers of the building where no other object (whether it’s a building, resource or any other object). This collider can actually cover more than the building’s model.
Add a Rigidbody component to the main building object and Set “Is Kinematic” to true and “Use Gravity” to false.
Add an Audio Source component to the main building object and make sure that:
- “Spatial Band” is set to 3D (equal to 1).
- Under “3D Sound Settings”, set “Doppler Level” and “Spread” both to 0. “Volume Rolloff” should be set to “Linear Rolloff”. And set the “Min Distance” and “Max Distance” to show how loud you want sound coming from the building to be heard from distance.
Navigation Mesh Obstacle:
Add a “Nav Mesh Obstacle” component to the main building object and Set “Carve” to true. Make sure the Navigation Mesh Obstacle size is smaller than the Frontier Collider.