So the code for reading the z-rotation look like this:

`valText.text = "z local Val: " + transform.localEulerAngles.z.ToString() + " z global Val: " + transform.eulerAngles.z.ToString();`

And I’m rotating the object on the local y-axis but it says the local z-axis rotates, too. Is it because the object has no parent. If yes, how can I get the values of the same axis, which the local rotate-gizmo shows?

Here is the Video.

Well there are many misconceptions of local space / local axis / local rotation / local position.

First I think it’s important to clear this up first. Every gameobject creates / represents it’s own local space. This space is represented by it’s local axis. However the local position and the local rotation of an gameobject are of course not relative to it’s own coordinate space. That wouldn’t work since the local position and rotation defines that coordinate space. The local position / rotation defines the object’s position and rotation relative to the parent object. So those two values are defined in the parents local space.

Objects which do not have an explicit parent are implicitly a child of the world. That means the localPosition is equal to the world space position. Likewise the localRotation / localEulerAngles are equal to the worldspace rotation / eulerAngles.

So the first thing we can already get from this is that the localEulerAngles of an object does not represent rotations around it’s own local axes but around the parent axes.

Next thing is euler angles is not one thing. Euler angles are 3 consecutive rotations applied to the object in a certain order. Just assume that the object is originally aligned with it’s parent (so it has a localEulerAngles of 0,0,0). Unity uses the rotation order **Z → X → Y** around the **parent axes**. Note that this is equivalent to the opposite rotation order around the object’s local axes. Since your object seems to be tilted around X, when you rotate around the local Y axis you actually change all 3 angles at once.

If you want a relatively “clean” rotation around a certain axis you should use a parent that is actually tilted so you can rotate around a single axis of the parent.

Finally a warning about reading eulerAngles / localEulerAngles. Unity does not work with euler angles internally since eulerAngles have several issues. Unity, like most gameengines, uses Quaternions to represent rotations. Quaternions do not represent the orientation by 3 seperate consecutive rotations but as a single operation. A quaternion defines an arbitrary rotation axis and the amount to rotate around that axis. Unity actually calculates the eulerangles representation backwards from the quaternion rotation. Though his is a problem because euler angles do not have a unique representation of a certain orientation. Therefore two or more euler angles combinations can result in the same orientation. That means when the euler angles are calculated from the quaternion Unity will not necessarily end up with the same kind of euler angles representation. So using euler angles to read the orientation could fail in several edge cases. The most well known edge case where eulerangles completely fail is a gimbal lock configuration

No, if an object has no parent the local rotations/positions equal their global counterparts.

You face mutliple problems here:

First up: You kind of misunderstood how the angles display a relative rotation. Basically you get a clean change of you axis angle when the axis is aligned with the corresponding axis of your parent transform. (If there is no parent it’s the global transform)

Secondly: For each possible rotation there are multiple euler variants to describe this rotation. For this reason you can not rely on euler angles to keep specific values even though you rotate around one specific axis. This means that when reaching a certain angle unity might flip signs on one axis and add some values on the others just on a whim. (While still maintaining the exact same rotation)