ImageMarker randomly working on build

So, when building an app I get a very weird behaviour I haven’t found a pattern to detect the problem. Randomly, when building the project to an Android device, the ImageMarker sometimes work, and more often than not it doesn’t work. I don’t get any related error message anywhere and couldn’t figure out what’s the problem, so I decided to send you guys a bug report directly from the project with some instructions to recreate the problem I’m having (Case 1350686).

Now, the ImageMarker DOES work on the simulation view, but once the project is built, it doesn’t anymore.

The main purpose of opening this thread is to keep a more dynamic conversation with you guys, and further help the community if someone faces this issue too.

Hey there,

I am looking at your project and it’s giving me several issues and doesnt let me compile.

Being said that I checked also your editor logs and whatnot and as you mentioned, nothing seems out of the ordinary. I have tried to compile several times a project with just an image marker and I can get it to match every time (on iOS).

Could you try reproducing this random issue with just an image marker?; This is to find out if the problem is MARS related or it’s being affected from other plugins you have in your project.

Also; If possible; could you share your ADB logs (not unity’s we checked them already) for a version that matches image markers and logs for one that has the issues you mention?

Hey! thanks for your help! I’ll be compiling hoping for a good compilation and get back to you ASAP with the ADB logs.

So, I’ve been compiling for hours and never got a lucky build, but I did create a new scene with only an image marker and the same prefab I was using before and worked fine through 3 builds. Came back to the original problematic scene after that and still doesn’t work. I’m very close to deadline and we’re practically only missing this, so I’m feeling a bit desperate to be honest.

Since I couldn’t get it to work on the bad/problematic scene (It’s called “Main AR”), I made these logs from a working new scene and the Main AR scene.

Bad compilation (Main AR):
https://drive.google.com/file/d/1jabkJ2n1w1DCo44WFN2JTp1oyDzVjOsr/view?usp=sharing

Good compilation (new test scene):
https://drive.google.com/file/d/1CUy5IfZrS2BAFL9hjUO8LhJZ49LuEN-Y/view?usp=sharing

I spun up your project with the latest 2020.3 and built it to Pixel 3 three times and it seemed to work each time (see a sphere in front of the marker).

Looking at the ADB log you uploaded the only thing that I notice is an exception from JSONToAddressables:

07-19 16:04:27.370 16748 16814 E Unity : IndexOutOfRangeException: Index was outside the bounds of the array.
07-19 16:04:27.370 16748 16814 E Unity : at JSONToAddressables.DivideCode (System.String code) [0x0001c] in D:\UnityProjects\EpixARURPv2\Assets\Scripts\JSONAPI\JSONToAddressables.cs:347
07-19 16:04:27.370 16748 16814 E Unity : at JSONToAddressables.GetQRStringFromMemoryStorage () [0x00013] in D:\UnityProjects\EpixARURPv2\Assets\Scripts\JSONAPI\JSONToAddressables.cs:68
07-19 16:04:27.370 16748 16814 E Unity : at JSONToAddressables.Start () [0x00001] in D:\UnityProjects\EpixARURPv2\Assets\Scripts\JSONAPI\JSONToAddressables.cs:56

I don’t see this exception when I run it on my device so I wonder if that’s causing some interference with the image tracking.

Thanks for your reply! I did disable anything from the scene non-related to a vanilla MARS build and the problem persists. I now don’t have the exception too.

7345625--893510--upload_2021-7-20_12-4-38.png

Hey, so I did something. I made a prefab of the whole MainAR scene (the one that doesn’t work), put that in a new scene (the one I used for testing), unpacked the prefab completely and it worked fine, so I guess the problem is the MainAR scene. This is a workaround of the problem but still the bug remains.