Have setup a XR Rig with AR Session and AR Plane Manager. Have checked and activated permissions for Spatial Mapping. When running on device i get the following error: Error: XrBeginPlaneDetection in the Magic Leap API failed. Reason: SpaceNotLocatableEXT.
Any help with understanding why this error is occurring would be great. Thanks!
Unity Editor version (if applicable): 2022.3.37f1 ML2 OS version: 1.8.0 MLSDK version: 2.3.0
Error messages from logs (syntax-highlighting is supported via Markdown):
What this error is telling you is that the base space you are passing into the plane query is not locatable and thus the runtime cannot answer your query at all. When you receive that specific error try again in a future frame when hopefully the floor level is established.
Make sure that you have the Reference Space feature enabled. Then you can set your xr origin to Device, so it will not have to wait for the floor height to be established.
Hi @kbabilinski thankyou for the explanation. I found that the error can also occur if you attempt a query before the permission has been granted. I have resolved this in my code but planes are still not detecting.
I can confirm reference space feature is enabled and XR Origin is set to Device. I also call the query on the main Update loop; it never responds with any plane being created via the AR Plane Manager. My code is pretty much identical to the sample here [Planes Query | MagicLeap Developer Documentation].
I installed the Unity XR Simulator to see if it would work there. When running with this it rarely detects a plane in the editor (approx. 1 in 20 runs) and the plane classification is always returned as "None".
Any ideas on what could be causing planes to not be detected?
Interesting, I was not able to reproduce this using the latest OS and SDK.
I used the PlaneExample script from the documentation and added it to the Unity Examples Project. (I had to rename the script to PlaneExample2 so it would not conflict with the existing PlaneExample script).
Once I renamed it, I opened the Hello Cube scene and added the PlaneExample2 component to an empty GameObject. Then I added the ARPlaneManager component to the XR Origin object and assigned the demo Plane Prefab from the Assets/Prefabs/ folder.
When I ran the example application, the scene prompted me for permissions and then displayed the planes on the flat surfaces.
I found the issue. It was an error on my part when copying the example from the website I didn't copy the 'using' section from the top of the class. VS then auto filled these to use the old ML ones instead of the OpenXR. It still compiled as the functions called are identical but on device it threw the error I posted originally!