Rotation gives negative value when button is pressed

When I use this code and I press 180positive value it makes the object -180 rotate on y.
I don’t understand why Vector3.up90 till Vector3.up170 gives positive value, but once is Vector3.up*180 gives negative value. Any thoughts?

    if(GUILayout.Button("Test Button"))
  {
     Debug.Log (Vector3.up*180);
  }

outputs (0.0, 180.0, 0.0)

  GUILayout.BeginHorizontal();
   var obj = Selection.activeGameObject;
  if(GUILayout.Button("180ยบ")){
     obj.transform.Rotate(Vector3.up*180);
  }else if(GUILayout.Button("90ยบ")){
     obj.transform.Rotate(Vector3.up*90);
  }else if(GUILayout.Button("-90ยบ")){
     obj.transform.Rotate(Vector3.down*90);
  }else if(GUILayout.Button("-180ยบ")){
     obj.transform.RotateAround(obj.transform.position,obj.transform.up,180);
  }
   GUILayout.EndHorizontal();

As a quick fix seems like if I do double 90 on one press of a button it gets a positive value

    if(GUILayout.Button("180ยบ")){
     obj.transform.Rotate(Vector3.up*90);
     obj.transform.Rotate(Vector3.up*90);
  }

I’m a little confused, there is no “movement over time” in that code, so 180 or -180 is still going to be the exact same instant rotation… why are you concerned about “negative values”, and where are you seeing them given there is no debug information in the code?

This is not a code that runs at run time it’s a window GUI element. It rotates selected object at fixed amount on button press. Output is in Inspector window transform → rotation → y axis

I select an object, press the button, Vector3.up = 180 it’s rotates the object in negative value that’s -180 y axis(horizontal axis) the negative value should be from Vector3.down = 180

tl;dr
this is in EditorWindow
Vector3.up = 180 should be 180 instead I get -180
Vector3.down = 180 is -180

180 = -180 in true angle, so they’re interchangeable. When two notations of the same number equal the same real rotation, the program picks one arbitrarily. In your case, that’s -180. It doesn’t affect the rotation in any way, as it’s still where you’d rotate it to.

A good way to think about it is turning around. If you turn around to the left, -180, you’re facing the same way as if you turn around to the right, 180.