How do I set and get local rotation of objects

I have 3D model of robotic hand, that I want to control with C# code. I want to be giving specific rotation to fingers in range 0-90 degrees, so if I want my hand to be open, I will pass value of 0, if I want it to be closed, I will pass 90.
In order to rotate the fingers properly, the rotation must be local, but I don’t know how to get local rotation of object and set local rotation.

Any tips on controlling fingers in unity? (By the way, I am using glove, outside the pc, that is communicating with unity, that’s why I want to set values to finger rotations and not increment or decrease using Transform.Rotate(x, y, z, Space.Self).

You can use Transform.localEulerAngles or Transform.localRotation to set the local rotation. Note that reading from eulerAngle can cause issues since there are multiple Euler representations for any given physical rotation. It is best maintain your own Vector3 and treat eulerAngles as write-only.