Set specific end x,y,z values for rotation

I have an object that I want to rotate. I know what it’s current rotation is, and I know what I want it’s final rotation to be.

I’ve tried setting the EulerAngles, but that doesn’t work. It rotates the Y correctly, but not x and z. I’ve tried using rotation, but I can’t figure out the correct rotation to use.

For example, let’s say I have my object set with rotation (40,250,0). I want the final rotation to be (0,235,0).

I’ve tried:

transform.eulerAngles = Vector3(0,235,0); 

But I will end up with something similar to (40, 235, 2.5), where the y rotation is correct, but x and z aren’t. What am I missing?

transform.rotation = Quaternion.Euler(40,235,2.5);

First check that ur object is a child or a parent… Because changing the eulars angles will change the rotation in global axis…