enemy look at player unity 2d code example
Example: enemy look at player unity 2d
Vector3 dir = enemy.position - transform.position;
float angle = Mathf.Atan2(dir.y,dir.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle -90, Vector3.forward);