Search Unity

Controlling rotation

Discussion in 'Android' started by bpritchard, Aug 31, 2012.

  1. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    Morning everyone,

    I need to inject a rotation control into our unity app doing something along these lines...

    Code (csharp):
    1.  
    2. setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    3.  
    4. by adding:
    5.  
    6. WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    7. if (wm.getDefaultDisplay().getRotation() != Display.ROTATION_90) {
    8.               setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSED_LANDSCAPE);
    9. }
    10.  
    is this something i can do within unity or do i need to access this in some other fashion? Or is it even possible at this point?