title: Have an enemy follow the player in Unity3D
body: <p>I made a script to have an enemy to follow the player, after the player collided with the ground.</p>
  
  <p>I'm facing a problem that is that the enemy walks to the start point and not to the player.</p>
  
  <p>it would be cool if someone could help me with that :)</p>
  
  <pre><code>Transform tr_Player;
  float f_RotSpeed = 3.0f, f_MoveSpeed = 3.0f;
  
  public int gegnerLeben;
  Rigidbody m_Rigidbody2;
  Vector3 m_YAxis2;
  
  public int leben;
  public GameObject Player;
  public GameObject verfolgen;
  public GameObject MinenGener;
  
  void Start()
  {
  
      tr_Player = Player.transform;
  
      m_Rigidbody2 = GetComponent&lt;Rigidbody&gt;();
      m_YAxis2 = new Vector3(0, 5, 0);
  
  }
  
  
  public void GegnerFreez()
  {
      m_Rigidbody2.constraints = RigidbodyConstraints.FreezePosition;
  }
  
  void Update()
  {
      if (Player.GetComponent&lt;SpielerScript&gt;().MineBetreten == true)
      {
          MinenGener.transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(tr_Player.position - transform.position), f_RotSpeed * Time.deltaTime);
          MinenGener.transform.position += transform.forward * f_MoveSpeed * Time.deltaTime;
      }
  
  
      if (gegnerLeben &lt; 1)
      {
          Destroy(Player.GetComponent&lt;SpielerScript&gt;().MinenGegner);
      }
  }
  </code></pre>