Unity issues with Chrome, also iOS 14


#1

Does Universal AR for Unity work on iOS Chrome? All I get is a white screen.
Update: Apparently, the only camera-enabled browser on iOS is Safari.

On iOS 14, I get a white screen for 5-6 seconds before the camera activates.

I am using the iOS14 patch posted in this forum, because the absolute latest UAR Unity package was released after I started my project, and it crashes when I try to update it.


#2

I have now deleted all Zappar resources from my project, installed the latest SDK package, and when I drag the Image Target prefab into my hierarchy, CRASH. Every time.

update: I got around this by creating a GameObject for my ImageTarget and ONLY adding the ZapparImageTrackingTarget, not the additional ZapparEditModeImageTarget that is on the Zappar prefab. No crash.

Camera will not initialize in Chrome.
Update: This is happening on devices running Android OS v9.

I still get the 5 second white screen on iOS 14 after I grant camera access, though. Is there any way to get rid of this?


#3

Thanks for the update on iOS chrome!

I’m facing the same issue of 5-6 seconds of the plain white screen in iOS 14 Safari.


#4

It seems that Zappar has already known that Chrome on iOS is not supported. The default Zappar HTML template actually has a prebuilt screen instructing the users to copy the URL and paste it into Safari.

To solve the white screen issue, I modified the HTML template (We have an Enterprise Plan) so that it shows a custom message (“Waiting for camera”) while the camera is getting ready. Then I modified ZapparCameraBackground.cs so that it makes a custom JS call the first time it gets a non-null texture, so the browser could hide the message. This way there is at least a meaningful message on the screen while the camera initializes, instead of blank white space.


#5

Hi all, This issue persist on the latest Universal AR and iOS 14.7. Any one found a solution? @rendermouse would it be possible to elaborate on the changes you did on the HTML template?
Any help would be very much appreciated!!


#6

@rendermouse I’m having issues with uploading builds and. camera opening, but none of my images seem to want to track. Any instructions on getting image targets to work on WebGL would be greatly appreciated!!


#7

@pNik_Dev
Add a DIV in your HTML that has absolute position and covers the Unity canvas.
I put a message in that div that says “Waiting for camera” and display it after the loader has completed. Add a custom .jslib file in your Unity Plugins folder (alongside the existing zcv.jslib) that contains this code:

mergeInto(LibraryManager.library, {
JSCameraReady: function () {
    onCameraReady();
}
});

Then make your own copy of ZapparCameraBackground.cs, switch the Zappar Camera Background object to use your script instead of Zappar’s. Then edit your script to add:

private bool cameraIsReady = false;
[DllImport("__Internal")]
public static extern void JSCameraReady();

and where the code checks for valid texture, replace with:

if (m_currentTexture != null) {
            cameraMaterial.mainTexture = m_currentTexture;

        // notify the browser that the camera is ready
        if (!cameraIsReady) {
            cameraIsReady = true;
            
            #if !UNITY_EDITOR 
                JSCameraReady();
            #endif
        }
    }

Now the background camera will call a JavaScript method called onCameraReady() when the camera texture is ready, and you can add that JS method to your index.html template to hide your HTML DIV that covers the Unity canvas.

This solution allows you to display anything you want in the HTML while you wait for the AR Camera to be ready.


#8

@TreyS
I am not sure why your images will not track.

  • Did you train the image using the ZapWorks CLI tool and put the .zpt file in your Assets/StreamingAssets folder? If not, it doesn’t know what your marker looks like.

  • Does your Image Tracking Target gameobject have the same .zpt file selected as the target? If not, it does not know which target to look for.

  • Are your 3D model gameobjects children of the ImageTarget? If not, your target is being found, but your models are probably not in view at the target, they are off someplace else in world space. The ImageTarget is the center of your AR coordinate system, putting all of your 3D assets under that makes sure that everything is positioned relative to the target.


#9

Hi @rendermouse. Thank so much for the detailed reply. I have just tested your approach and its working great. I will also include an in-game loading bar for a visual indication.