Question by 
               mdbelalhero · Oct 12, 2016 at 07:27 AM · 
                duplicate  
              
 
              How to duplicate or spawn the enemy ai that will work as orginal?
When i duplicate the enemy ai the original one is working well but the duplicate one is only idle. it does not walk or attack. but when i attack the duplicate one both are die. Please help me.......
Here is my script.. using UnityEngine; using UnityEngine.UI; using System.Collections;
public class chase : MonoBehaviour {
 public Transform player;
 static Animator anim;
 public Slider healthbar;
 // Use this for initialization
 void Start () 
 {
     anim = GetComponent<Animator> ();
 }
 
 // Update is called once per frame
 void Update () 
 {
     if (healthbar.value <= 0) return;
     Vector3 direction = player.position - this.transform.position;
     float angle = Vector3.Angle (direction, this.transform.forward);
     if (Vector3.Distance (player.position, this.transform.position) < 10 && angle <60) 
     {
         direction.y = 0;
         this.transform.rotation = Quaternion.Slerp (this.transform.rotation,
             Quaternion.LookRotation (direction), 0.1f);
         anim.SetBool ("isIdle", false);
         if (direction.magnitude > 5) 
         {
             this.transform.Translate (0, 0, 0.05f);
             anim.SetBool ("isWalking", true);
             anim.SetBool ("isAttacking", false);
         } 
         else 
         {
             anim.SetBool ("isAttacking", true);
             anim.SetBool ("isWalking", false);
         }
     } 
     else 
     {
         anim.SetBool ("isIdle", true);
         anim.SetBool ("isWalking", false);
         anim.SetBool ("isAttacking", false);
     }
 
 }
}
               Comment
              
 
               
              Answer by CrisStif · May 01, 2020 at 05:39 PM
wow I'm facing a very similar problem, did you get it fixed and how.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                