Start a new topic
Solved

Camera is not working on Android.

Hi,

I am using Unity 2018.3.3 and I notice that the camera never turns on. I deselected the multithread rendering, camera2 API, and metal. I tried both IL2PP and mono, but the camera always shows a black background.


I tried Unity 2018.2 with Wikitude 8.2 SDK. The camera works perfectly on Android and IOS phone. But it never works on Unity 2018.3.3. 

I can't downgrade unity because all prefabs in my project will be messed up. 

Is there any way I can solve the problem?


Thank you.


Hi, 


SDK 8.2 was tested with 2018.3 beta, which was the latest version available at the time of release and it was working there. I'll do additional testing with this specific version to see what the problems are and how they can be addressed.


Is the problem on both iOS and Android? Is it working in the editor? Can you please post the logs from both iOS and Android?


Thank you,

Alexandru

The camera works fine on iOS if I build my project with Unity 2018.3.3. But the camera is not working on the Android device. When I open my app on Android, it won't ask for camera permission.


When I build my app with Unity 2018.2.14 and open it, the Andorid phone immediately asks the camera permission.


The project setting is the same on both Unity 2018.2.14 and Unity 2018.3.3. 

The camera works fine in the editor on both Unity version as well.


Hi, 


Yes, the problem is that in 2018.3, Unity added new APIs to handle Android Runtime Permissions, and so they don't automatically ask for the camera permission when the app starts anymore. This is not something we can handle either, because we would like to let developers be in control of when permissions are asked, but in MenuController.cs, in the Awake method, you can see an example of how to handle this. I assume that in your tests you are not using this.

Please let us know if this fixes the problem for you.


Best regards,

Alexandru

Thank you so much! Now, the camera works perfectly after I added the permission code to my main scene on Unity 2018.3.3.


if (!Permission.HasUserAuthorizedPermission(Permission.Camera)) {

            Permission.RequestUserPermission(Permission.Camera);

        }

Login or Signup to post a comment