Quaternion amount/value of rotation?

Ok so I need to know how I can make this object(player controlled turret)which rotates on the Y axis to remember or get the value of the amount of a rotation that is happening, during a certain time.

What it does is rotates to a certain direction when a certain bool is true, which not using the input, as in you don’t control it while this bool is true and while its rotating to this specific direction. So what I need is that specific amount of rotation that has happened on the axis while it rotates to said direction on its own.

Let me explain in code:

    Quaternion XQuaternion;
    
//This is when the bool is not on and you are controlling the rotation with the Input of mouse.
    if(rTt != true){
    
       turretRotationX += Input.GetAxis("MouseX") * 1.6f * Time.deltaTime;
    
    }
    
   // So I want to do the same thing as above but not with the input but the amount the turret has rotated since the bool rTt has been true.
    
    if(rTt == true){
    
    //  turretRotationX += ??? AngleAxis? I don't how?
    
    
    
    }
    
   
    
// This is where the mouse input goes into the rotation. // XQuaternion is what I want to change into the amount of rotation that has happened during rTt == true.

    turretRotationX = ClampAngle(turretRotationX, turretMinX, turretMaxX);

    XQuaternion =  Quaternion.AngleAxis(turretRotationX, Vector3.forward);
    
    //rot is the original rotation of the turret set in Start. Shouldn't be an issue here. 
    
    tur.localRotation = rot * XQuaternion; 

So yeah, please help.

As far as I understand your question you want to modify the rotation of a GameObject.

Rotations are “stored” in Quaternions

Quaternions,
Quaternion.Euler

var rotation = Quaternion.Euler(10, 20, 30); // x:10, y:20, z:30

You can access the rotation on certain angels by

Debug.Log(rotation.x) //Prints the x rotation -> 10

Well you guys did help me a little in understanding my problem a little better, but I managed to avoid the whole thing by deleting it and replacing with:

    turretRotationX += Input.GetAxis("MouseX") * 1.6f * Time.deltaTime;

    transform.Rotate(turretRotationX , 0, 0);

This rotates without snapping.

However I don’t know how to limit the angle when using transform.Rotate, because I need it for the barrel. Its fine like this for the turret though.