Hey guys and happy new year Im using unity 2018.3 with ARFoundation 1.0 preview 22, and there is no focus to the camera. (the phone is Pixel 2). regardless to say this has a heavy impact on the AR performence... In the ARFoundation latest release post, there was an update for that autofocus capability https://forum.unity.com/threads/arfoundation-1-0-0-preview-22-released.598261/ but it doesn't seem to achieve it. Do we need to set it up somehow? I've tried to look in the camera inspector and components but found nothing. thanks for the help!
Hi, thanks for the quick response. sorry, can you elaborate what you mean? it seems that I can't implement your solution(s)... (its probably cause don't have so many years of experience... Do I need to attach script component to the camera game object? if yes, what should be the code?
Attach the ARCameraOptions script to a GameObject in your scene. The inspector UI for this MonoBehaviour includes a setting for the camera focus mode.
Where do you get this script? I've updated to the latest version of Unity and Package Manager states that I'm up to date for the ARFoundation/ARKit/ARCore packages, but I'm unable to locate the script in my project.
On disk, it is <Package Cache>/com.unity.xr.arfoundation/Runtime/AR/ARCameraOptions.cs: As a component, click the Add Component menu on any GameObject, and search for "ARCameraOptions": The component then has an option to set the focus mode:
Am I doing something wrong? I've navigated to the folder you indicated and not only am I missing the ARCameraOptions script, but I'm missing several other scripts that I can see in your screenshot. All of my installation and updating of ARFoundation was performed through the package manager. I just tried removing and re-adding it, but I'm still missing those scripts.
You need ARFoundation 1.0.0-preview.22 to get this feature. You should be able to update using the UI in Window > Package Manager .
Package Manager says that 1.0.0-preview 22 is not available. The highest version I can get is 1.0.0-20. I'm using Unity 2018.2.20f1 Pro, which the editor claims is up to date.
As @newguy123 suggests, you also need the latest version of Unity (2018.3) to use ARFoundation preview 22.
@newguy123 Thank you. I was able to find Unity 2018.3 by installing the hub as suggested. @tdmowrer Thanks for the help, but it appears that ARfoundation preview 22 is a non-starter for me. There seems to be a bug in either the ARFoundation or ARCore package that produces a null reference crash if you start with ARSession disabled and then attempt to reenable it later. Specifically, this line crashed: Code (CSharp): arSession.enabled = true; Reverting the packages back to their older versions stopped this crash from occurring.
adb logcat -b crash should give you a callstack. Also make sure you are on the latest version of ARCore XR Plugin. There was a similar crash bug which was fixed a couple of months ago.
Dumb question, but can you point me to a guide on how to use that command? I was on the latest version of ARCore when the crash happened. Actually, I suspect that the ARCore package is the problem because I have a version on a mac that builds to ios with the same code and all the updated AR packages and that's working fine.
Let's back up. If you aren't using logcat, how do you know where it crashed? Toggling the session, switching between AR and non-AR enabled scenes, and delayed session enabling are things that we test for regularly. Just to be sure, I've just run that test locally and delayed session enabling works as expected. Do you have any other information you can provide as to how to reproduce this issue or how you are able to know what specific line is problematic?
I'm sorry, I've been phrasing this wrong. It's not an actual crash. It's a freeze where the AR doesn't end up turning on and the on-screen UI becomes completely unresponsive. I found that when I commented out only that specific line, the UI wouldn't freeze although there was obviously no AR. The only other information I can tell you at this point is that there's a videoplayer and canvas that's created within the same frame.
@tdmowrer Hello again! Just to let you know, I took another look at my problem again today and was able to figure out what was going on. I had extracted the AndroidManifest xml into the Plugins folder when I was using a earlier version of ARFoundation/ARCore to add some permissions. I wasn't aware that update to the ARCore package raised the required minimum arcore sdk version and so, hadn't changed that value in the extracted manifest. Everything seems to be fine now. Sorry for the trouble!
Just checking in on this camera out of Focus issue. Are there any updates/ Fixes to this issue. I'm having the same issue on pixel devices I'm on Unity 2019.4.8f1 and latest ARFoundation & ARcore
On newer Pixel phones (3+ I think), it defaults to a 60Hz configuration which does not support auto focus. See https://developers.google.com/ar/discover/supported-devices for details about your specific device.
Hi @tdmowrer ! How are we suppose to support the devices that don't have auto-focus for one reason or another? For example the G7ThinQ has a wide lens and only supports a fixed focus. Right now, the AR camera manager component is set to Auto focus in my scene and it's blurry with the devices that only supports fixed focus. Maybe I'm missing something but what is the right approach to support both fixed and auto focus cameras? Thank you
Google's list of ARCore supported devices indicates which devices support auto focus. The entry for the LG G7 ThinQ says: There is no way to enable auto focus on a device that does not support it, nor is there a way to programmatically detect it (ARCore will report whatever was requested, not what it is actually doing).