unity 2d lookat gameobject code example
Example 1: 2d object look at object
Vector3 dir = enemy.position - transform.position;
float angle = Mathf.Atan2(dir.y,dir.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
Example 2: unity look at 2d
transform.right = target.position - transform.position; // Works like a CHARM.