Start a new topic

Add camera request to enable ImageTracker work "out of the box"

I'm using Unity 2019.2.5f and Wikitude 9.0.0

I spent some time trying to figure out why my app wouldn't show the camera feed when I build, but it worked in the editor.

The same happens when you build just with e.g. the Simple Tracker scene in the sample.

Then I figured out that in the Main Menu scene in the sample, in the MenuController class, you get the app to ask for camera permission. This wasn't entirely logically to me to put it there.

Perhaps add those lines somewhere else, so one can simply drag e.g. WikitudeCamera + ImageTracker into a scene and then it works.

I'm referring to these lines:

 

#if UNITY_2018_3_OR_NEWER && UNITY_ANDROID
using UnityEngine.Android;
#endif

//...

private void Awake() {
#if UNITY_2018_3_OR_NEWER && UNITY_ANDROID
        /* Since 2018.3, Unity doesn't automatically handle permissions on Android, so as soon as
         * the menu is displayed, ask for camera permissions. */
        if (!Permission.HasUserAuthorizedPermission(Permission.Camera)) {
            Permission.RequestUserPermission(Permission.Camera);
        }
#endif
    }

 

 

 

1 Comment

Hi Aske,


thanks for bringing this to our attention - in 9.0 EE you can already find a corresponding change, where camera permissions are handled per sample. We plan to bring this to PE with 9.2 to make your and other developers life easier.

Thanks again for the feedback - very much appreciated!

Phil

Login or Signup to post a comment