How to detect screen orientation when I just support one orientation

My game is meant to be played in Portrait mode only but it has some features which I want to activate when the user holds it in other screen orientations. Is there a way to detect that?

Hello,

and

I am not quite sure if you want to support both orientation or not. But You know you can force the game to have only one orientation. This is in the options of your build settings. Is it what you asked for?

If you’ve disabled the auto-rotate, then the only thing left (that I know of) is the accelerometer itself. See the last answer at the link above.

Thanks for the reply.
@laurelhach: I want the game to be played only in portrait orientation, but its a puzzle game where, when you hold the phone in different orientation you see the missing pieces, so I just want to detect the orientation the user is holding the phone in. And I knew about the options in the build setting.

@wccrawford; Thanks for the link.

Although I have found that the device orientation is also given through Input.deviceOrientation. But its gives out the position in very specific way, I mean your phone has to be at a particular angles for it to give the output, so I will have to write some custom code.