it should work, but they won’t align.
lets say Parent is at 5 degrees
child is at 10 degrees
after your operation,
parent = 10 degrees.
but since child is … a child, it will be moved accordingly, so since child’s local rotation is 5 degrees (relative to parent) child will now be 15 degrees, still 5 degrees more than the parent.
to have them align, just call child.transform.localRotation = Vector3.zero immediately after your operation.
I don’t want them to align at the end. I just want the parent to align to the child before rotation. So in your example, the parent = 10 degrees and child = 15 degrees is exactly what I want.
But I found another way to achieve what I want, thanks.