Run script when camera has turned x amount degrees

Greetings everyone.

I’m messing around in Unity and I was wondering if it’s possible to run a script when the camera turns 90 degrees in the x or y direction. The player is the parent object and I’m thinking about turning the gravity when the camera rotates

Yeah that sounds fairly easy. Just attach your script to your camera and make a script.
You’ll want the transform from the camera. Then look at the localRotation of the Camera. If you detect 90º in either axis trigger your script.

Thanks LLIV for the reply.
An update:
I have created the following code in a script for the main camera in the update function

         if (Camera.main.transform.localRotation.z > 90) {
             Physics2D.gravity = new Vector3(0, 30, 0);
         }

But it doesn’t seem to work, and I don’t know why