Log in or register to post comments

Vuforia 2.0 for iOS Issue: Change ScreenOrientation

March 6, 2013 - 6:21am #9

I have a problem with the change of orientation from Landscape Left to Portrait in Vuforia 2.0 for iOS in Unity. 

I use this for orientation change:

 

Screen.orientation = ScreenOrientation.Portrait;

In Vuforia 1.5 it all still works great. It also works with Android with Vuforia 2.0. Only it does not work with Vuforia 2.0 with iOS.

This is the log output from XCode:

 

OpenGLES error 0x0502 in /......./Classes/iPhone_GlesSupport.cpp:224
OpenGLES error 0x0502 in /......./Classes/iPhone_GlesSupport.cpp:224
OpenGLES error 0x0502 in /......./Classes/iPhone_GlesSupport.cpp:224

.......

The app does not crash, but the GUI is not shown. :(

What's the problem?
What has changed in Vuforia 2.0? 
Why does the error not in Android?

 

Regards,
Russel

 

Vuforia 2.0 for iOS Issue: Change ScreenOrientation

March 6, 2013 - 7:47am #8

You need to understand that lots has changed from the Unity perspective as well, particularly to do with orientation, splash screen and openGLes integration.  Note also these changes appear to be ongoing...

From a Vuforia perspective we track these changes and update the PostProcessBuildPlayer, which inserts calls in the generated project to match and changes in orientation.

 

What's the problem?

Hard to say.

If you are setting your own orientation, you may need to add more code to get Vuforia to track this. Search for QCARUnityPlayer in AppController.mm and you will see what I mean as you will see instances of:

 

QCARUnityPlayer::getInstance().QCARSetOrientation(_curOrientation);

 

What has changed in Vuforia 2.0? 

Lots has changed, though the chances are it is a problem with Unity rather than Vuforia, because all that happens is Vuforia hooks into the orientation changes.

Which version of Unity are you using?


Why does the error not in Android?

Because the project is generated on a completely different platform

 

N

Vuforia 2.0 for iOS Issue: Change ScreenOrientation

March 12, 2013 - 4:05am #7

I have to wait with WaitForSeconds() shortly with the deactivation of the ARCamera. Then it works :).

Thank you for your answer.

Vuforia 2.0 for iOS Issue: Change ScreenOrientation

March 12, 2013 - 4:41am #6

Ok - thanks for posting your fix here.

N

Vuforia 2.0 for iOS Issue: Change ScreenOrientation

December 17, 2013 - 1:42am #5

Hello, Russel.

I am facing the same problem on a different scope. I have a scene with all the Vuforia components and at some point, I run Application.LoadLevel to load the main screen. After that, while in the main screen, if the orientation is changed (what is automatically tracked by Unity, not by me), I have the same problem that was happening to you. 

I tried to apply your workaround deactivating the ARCamera and using waitforsecoinds before using loadlevel, but the problem is still there. It is weird because it fails in a different scene and only when I go back to it form the Vuforia scene...

Any ideas on how to solve it?

Thank you very much in advance!

Vuforia 2.0 for iOS Issue: Change ScreenOrientation

December 17, 2013 - 2:15am #4

Try WaitForSeconds in the other scenes (not Vuforia scene) in Awake().

Vuforia 2.0 for iOS Issue: Change ScreenOrientation

December 17, 2013 - 2:36am #3

Hi, Russel and thank you for your quick response.

I have deactivated the main camera in the scene with the problem and added a waitforseconds(5f) before activating the camera in the Awake method, but I am still having the same problem. Once I rotate the device, it doesn't show anything. It is weird because it only happens when coming from the AR scene, it works like a charm in the rest of cases.

Any other suggestions? I am totally lost...

Thank you again!

Vuforia 2.0 for iOS Issue: Change ScreenOrientation

December 17, 2013 - 3:23am #2

Ok. I have found a workaround for my specific case.

It seems that if I add a script with an OnGUI method with a DrawTexture call with a 1x1 texture (I used the color of the background) it works. The script was in my main scene (the one I come back to from the Vuforia scene). After this, I think it is caused by a racing issue, but I couldn't figure out what is happening yet. The fact that it occurs in a totally different scene from the Vuforia one is driving me crazy.

Any ideas to improve the workaround? I don't want a senseless OnGUI call each frame!

Thank you again.

Vuforia 2.0 for iOS Issue: Change ScreenOrientation

December 17, 2013 - 5:46am #1

Maybe you have to use WaitForSeconds() when screen orientation change like this http://answers.unity3d.com/questions/202636/screen-orientation-change-notification.html?

 

Log in or register to post comments