Enemy Detects Buildings?

Hi Guys,

I have a simple chase script however my setting is a city and there are alot of buildings. The Enemies spawn behind the buildings and most of them seem to make their own way to my player and chase him which is great, however 1 or 2 seem to constantly bump into the buildings and get stuck. How do i get my enemy to detect buildings and somehow chnage their direction? I have been playing around with this:

Blockquote function OnCollisionEnter (collision : Collision) {

  if ( collision.gameObject.tag == "Building" )  {
      print("Hit Build");
      transform.eulerAngles = Vector3(0,180,0);
  } 

}
Blockquote

Google 'pathfinding' There are some pathfinding scripts on the Unity script wiki that might help you.