Why is Vector2.Angle() returning 90 regardless of input for me?

Hey all,

Fairly new to Unity and just trying to calculate the angle between a point of origin and a target in 2D space. The code I’m using is:

public class BrokenThing : MonoBehaviour 
{
    public GameObject player;

    void Update () {
        Vector2 offset = player.transform.position;

        Vector2 origin = new Vector2(0, 0) + this.offset;
        Vector2 target = new Vector2(0, 0);
        float angle = Vector2.Angle(origin, target);
        
        Debug.Log(angle);
    }
}

I would expect that when player moves around the angle would update but as it stands the angle always returns 90. I can also see that the x and y values for origin are changing as the player moves around the environment. Could someone let me know where I’m going wrong?

The problem is that Vector2(0, 0) is not a vector, but the origin point. So any other vector that is not also zero, is perpendicular to this point, so 90 degrees makes sense. Try something like Vector2(1, 0) instead.