Get angle of Vector2

I tried using Vector2.Angle(new Vector2(1, 0), vec);, but it didn’t work in all cases. Is there a better solution?


I ended up using Mathf.Atan2(vec.x, vec.y);, and it works perfectly for my purposes.

If you are trying to get the angle of the game object you can get it by

Vector3 vec = Object.transform.eulerAngles; 

where Object is the your gameObject

if your trying to assign an angle to game object you

Object.transform.eulerAngles= new Vector3(1,0,0);

You have to take vector3