I have a GameObject in Unity and I need to change its X and Z rotation without doing anything with the Y, as that would mess up everything.
Note that this sets the Y rotation to 0 and I don't want that (I want it to let it be be what it already is), so this isn't any good:
gameObject.transform.rotation = Quaternion.Euler(someNewAngle, 0f, someNewAngle);
What should I do?
transform.Rotate
(change the direction by a relative amount) ortransform.LookAt
(yaw and pitch to a point while keeping alligned with the horizon) might be useful for your use-case. – Philipp Nov 13 '18 at 10:21