Exemplo n.º 1
0
 private void SetUnityScreenOrientation()
 {
     mScreenOrientation = Screen.orientation;
     SurfaceUtilities.SetSurfaceOrientation(mScreenOrientation);
     // set the native orientation (only required on iOS and WSA)
     setSurfaceOrientationiOS((int)mScreenOrientation);
 }
Exemplo n.º 2
0
        private void SetUnityScreenOrientation()
        {
            mScreenOrientation = Screen.orientation;
            SurfaceUtilities.SetSurfaceOrientation(mScreenOrientation);
            // set the native orientation (only required on iOS and WSA)
#if ((UNITY_IPHONE || UNITY_IOS) && !UNITY_EDITOR)
            setSurfaceOrientationiOS((int)mScreenOrientation);
#endif
        }
Exemplo n.º 3
0
        private void CheckOrientation()
        {
            // check for the activity orientation for a few frames after it has changed in Unity
            bool getOrientationFromJava = mFramesSinceLastOrientationReset < NUM_FRAMES_TO_QUERY_ORIENTATION;

            if (!getOrientationFromJava)
            {
                getOrientationFromJava = mFramesSinceLastJavaOrientationCheck > JAVA_ORIENTATION_CHECK_FRM_INTERVAL;
            }

            if (getOrientationFromJava)
            {
                // mScreenOrientation remains at the value reported by Unity even when the activity reports a different one
                // otherwise the check for orientation changes will return true every frame.
                int correctScreenOrientation = (int)mScreenOrientation;

#if UNITY_ANDROID
                if (mCurrentActivity != null)
                {
                    // The orientation reported by Unity is not reliable on some devices (e.g. landscape right on the Nexus 10)
                    // We query the correct orientation from the activity to make sure.
                    int activityOrientation = mJavaOrientationUtility.CallStatic <int>("getSurfaceOrientation", mCurrentActivity);
                    if (activityOrientation != 0)
                    {
                        correctScreenOrientation = activityOrientation;
                    }
                }
    #endif
                ScreenOrientation javaScreenOrientation = (ScreenOrientation)correctScreenOrientation;
                if (javaScreenOrientation != mJavaScreenOrientation)
                {
                    mJavaScreenOrientation = javaScreenOrientation;
                    SurfaceUtilities.SetSurfaceOrientation(mJavaScreenOrientation);
                }

                mFramesSinceLastJavaOrientationCheck = 0;
            }
            else
            {
                mFramesSinceLastJavaOrientationCheck++;
            }
        }
Exemplo n.º 4
0
 public void InitializePlatform()
 {
     VuforiaWrapper.Instance.InitPlatformNative();
     SurfaceUtilities.SetSurfaceOrientation(UnityEngine.ScreenOrientation.Landscape);
 }