Copying the local rotation attributes to a quaternion?

So I want to store an objects rotation. I want to modify it in various ways without modifying the object itself, however some of those ways require that objects localness. I can’t use Space.Self attributes directly on a Quaternion variable that I’m aware of. Transform has that function, but I want to modify a Quaternion variable.

transform.Rotate( euRotation, Space.Self ); //only for transforms

The only solution I can think of is to store the rotation of the object, then rotate it, store the new rotation, and then turn the object back to its original position. That sounds like messy code however, and I was wondering if there was a better way to do it?

I’m sorry if I missed something completely obvious.

transform.rotation is Quaternion… isnt it allowing you to set it to the new quaternion directly?

Working with quaternions is tricky, which is why Unity has the Rotate shortcuts. But one nice thing is you can look up quaternion use in any 3D math forum.

To rotate quaternions, use * on two of them. The order is global or local (yes, in Quaternions AB is not BA):

Quaternion myR=transform.rotation;
Quaternion spin45=Quaternion.Euler(0,45,0);

Quaternion meWorld45 = spin45*myR; // or the other way
Quaternion meLocal45 = myR*spin45; // I always get them confused

transform.rotation = meLocal45;