Gyroscope.attitude = GetComponent ().TransformDirection ?

My gyroscope isn’t working properly, so i want to re-write Gyroscope.attitude based on local axis of an object. The object has definetely right axis, so if i will use it, gyroscope should work properly.

Is it possible and how? I am trying something like

Gyroscope.attitude = GetComponent<Transform> ().TransformDirection;

or

Gyroscope.attitude = GetComponent<Transform> ().InverseTransformDirection;

Yet not sure. Is it possible that way?

You can not overwrite the input form the hardware side, but you can make a wrapper class that you can put in between.

Hardware data → Wrapper class (corrects / transforms / replaces the incoming data to your will ) → end use of the gyro data

Instead of using the gyro directly in your script you have to use the wrapper class.