Hello. I have a perfectly working fine AR project made in Unity 2023.2.2 as shown in the first screenshot below. The pinkish background objects you see is the AR simulation environment. The yellowish planes are the trackable planes AR Foundation detects and creates during runtime.
As you can see the detected surfaces matches the virtual (pinkish) surfaces in the AR simulation environment. After this detection, I make some raycasts towards the detected surfaces via ArRaycastManager.Raycast method when the user is pointing the AR device to the QR codes on the walls to find out the raycast distance from camera to the detected surface behind the QR code. These all work fine in Unity 2023.2.2.
I have to upgrade my project to Unity 6. I performed most of the upgrade project work and it went mostly well. I didn’t encounter a major roadblock. The project looks working fine without any compiler or runtime errors BUT… as you can see in the second screenshot below, the detected surfaces (especially the horizontal one) is not accurately placed on the virtual (pinkish) floor. It floats up in the air. The vertical detected surface floats up in the air too but at least it’s still aligned with the vertical virtual wall.
And even worse, the raycast distance I get from ArRaycastManager.Raycast method is reported as greater than 1 meter even when my camera is much closer to the wall with the QR code. The actual distance was reported like half a meter or something in Unity 2023 but in Unity 6, it’s reported as much far.
Did anyone else experience similar problems with AR foundation in Unity 6?
Can I get an official response to fix this problem if I need to update anything in my project to make it work correctly in Unity 6?
Your planes look correct to me in the Game view? Note that if your XR Origin is not at position 0,0,0, AR Trackables in the Scene view won’t appear to line up. This is also how all other AR platforms work. The Scene view is a visualization of session-space, which is independent of Unity world space, while the Game view shows you the AR overlay.
It’s easier to visually reason about if you put your XR Origin at the same position and rotation as Unity’s world-space origin.
Game view looks correct because of the view point. The camera is looking down. That’s why it looks correct but it’s not. There clearly is a bug or some kind of change on the Unity side, not us.
As I mentioned, Unity upgrade went mostly well. There is no compiler or runtime error but the detected surfaces is clearly misplaced.
Since you mentioned XR Origin position, I checked it and I see that it’s at 0,0,0 but I also checked the Camera Offset too. During edit mode, In the scene structure, it’s at 0,0,0 too. BUT… during play mode, it’s being moved upwards for some reason. This only happens in Unity 6.
I tried manually moving it back to 0,0,0 during play mode and the surface detection and raycasts started to work fine.
So somehow we found a workaround solution now but I still think this is a bug because why would the Camera offset be moved upwards when entering play mode?
So the situation here is actually that this was a bug in AR Foundation 5 that we fixed in AR Foundation 6: Changelog | AR Foundation | 6.0.4
You can set your Camera Y Offset to 0 if you don’t want to apply a camera Y offset. We realize that most of our users are not aware of XR Origin’s Tracking Origin Modes, and that the default value of 1.1176 is likely set in most Unity 2023 projects, which is why we chose not to backport this bugfix to AR Foundation 5 at this time.
I’ve been trying to implement a simple face-tracking feature using AR Foundation, but I’ve run into some issues. The feature I’m aiming for is straightforward: when the camera opens, it should track the user’s face and overlay materials (like filters) on the face in real time.
Here’s the problem:
I’ve tested this on Unity 2019, Unity 2022, and even Unity 6, but none of them seem to work as expected.
When I run the application, all I can see is the skybox, even though I’ve followed the steps outlined in various tutorials and documentation.