Hello Unity community,
I’m facing an issue with my Unity AR project on iOS, and I’m hoping to get some guidance from the experienced members here.
The problem I’m encountering is that on each build the camera background either appears completely black or freezes after a short time on iOS, while everything works as expected on Android.
I’ve tried several approaches to troubleshoot this issue:
-
Experimented with different 2022 & 6 LTS versions of Unity, but the problem persisted.
-
Tested the sample asset project’s basic image tracking scene, and it worked fine on iOS. So, I made a lot of changes to my project’s settings and scene setup, basing it on the sample asset example scene. However, I’m still getting the same result, and I’m not sure what I might have missed.
At this point I don’t think the issue is in the project settings, as I can make a build with the sample scene, and it won’t have any issues on iOS. However, when I try my own scene, I will see the background problems.
The differences between the working sample scene and my problematic scene are very small. The main differences are:
- My code that manages and spawns objects for reference images
- A bit of UI
- A reference image library manager that enables the user to change/select libraries
I have a few very loose theories about what might be causing the issue:
-
I have deleted a component, thinking it was irrelevant, and it works fine on Android, but on iOS, it needs that component??
-
Activating AR/XR game objects later (meaning they are inactive in the scene normally and get activated by the user pressing a button) might be causing problems on iOS.
-
The ARTrackedImageManager might not be happy with changing its referenceLibrary at runtime on iOS, and this is somehow causing the issue.
Could someone please provide some guidance on how I can debug this problem or suggest any steps I might have overlooked? I’m really stuck (at this point more than a week) and would appreciate any help or insights the community can offer.
Thank you in advance for your assistance!
What component did you delete? You definitely need ARCameraManager and ARCameraBackground as noted here: Camera components | AR Foundation | 6.0.4.
If your project uses URP you also need the ARBackgroundRendererFeature on your Universal Renderer: Universal Render Pipeline | AR Foundation | 6.0.4
Thank you for your reply, I know sayıng something like “i deleted something i don’t know and now it doesn’t work” is a huge red flag :), but i deleted only the ones that are input / interaction related.
Camera setups are identical for both scenes they both have ARCameraManager and ARCameraBackground components on the camera gameobject, and their settings are identical too.
Here is a screenshot of two scenes that i was talking about, i have highlighted the ones i deleted with red
My project uses URP and i do have ARBackgroundRendererFeature on Universal Renderer settings…
What is puzzling me is, it works perfectly fine when i make a build for android with the exact same scene that has camera background issues on ios…
Small update, i have tried countless small things up until now with no meaningful change on the outcome and also made this repository for anyone interested in taking a closer look themselves:
What version(s) of AR Foundation and Apple ARKit XR Plug-in are you using? Your issue sounds like an old bug that was fixed over a year ago?
Currently 6.0.4, i sarted the project from unity 2022 ar template, that might explain the origin of the issue but i did update to the latest available version for 2022 and also after migrating to unity 6 but the issue never gone away…
Is it possible since i just updated those packages problem persisted, would removing and reinstalling all xr related packages fix the issue?
And your version numbers are the same for both ARKit and AR Foundation packages, right? Re-installing won’t help – the issue I’m thinking of is an old one related to multithreaded rendering.
I don’t see anything here that obviously points to it. If you’d like us to investigate, please file a bug: Unity QA: Building quality with passion
I appreciate you sharing the repo link here, but the way to get an engineer officially assigned to this issue is to use the bug reporting tool. Our QA team will try to reproduce this on various devices and get more information, then we can take it from there.
Re-reading your original post though:
Activating AR/XR game objects later (meaning they are inactive in the scene normally and get activated by the user pressing a button) might be causing problems on iOS.
Can you clarify what you are activating and de-activating?