how to make an enemy follow you in unity code example
Example: unity creating an enemy that follow player
public float speed; private Transform target; // Use this for initialization void Start () { target = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>(); } // Update is called once per frame void Update () { transform.position = Vector2.MoveTowards(transform.position, target.position, speed * Time.deltaTime); }