Set rotation in script like editor?

In the editor I can set the rotation of something using three seperate components, how can I use the same values in these components in the script? I tried Quaternion.LookRotation but it didn’twork…



transform.eulerAngles = new Vector(x, y ,z); // To set
Debug.Log(transform.eulerAngles.x); // To get

Notice these values are in global axis.