Closed ghost closed 8 months ago
Hello @MiriamCor thank you for submitting this plane finding issue! I am unable to reproduce this issue with your reproduction steps. I am using Unity 2019.4.29f1, MRTK 2.7.2 (via the Mixed Reality Feature Tool), Legacy XR, Plane Finding 1.0 to attempt a reproduction.
Below are this issues I ran into when trying to reproduce this issue on Step 3. Can you please provide some more information in your reproduction steps so that I can further investigate this?
Reproduciton issues When I try Step 3, I see these errors below. I tried to add "Microsoft.MixedReality.Toolkit.SpatialAwareness;" "using Microsoft.MixedReality.Toolkit.SpatialAwareness.Processing;" "using Microsoft.MixedReality.Toolkit.PlaneFinding;" to correct the errors, but Unity was still not able to find the "SurfaceMeshesToPlanes" namespace.
This is what the GameObject I have created based on the reproduction steps looks like. Does this look correct to you?
Thank you very much for your quick reply. I am out of the office until next Monday. As soon as I get back I will be able to attach more information and screenshots. Thanks again.
You are very welcome @MiriamCor! Enjoy your out of office time, and I look forward to your additional information and screenshots when you return.
Hello @elbuhofantasma!
The steps you have done are correct, you just need to configure the Scene with MRTK: Mixed Reality>Toolkit>Add to scene and Configure, and then, in the script of the GrameObject created add "using Microsoft.MixedReality.Toolkit.Experimental.SpatialAwareness;" to find "SurfaceMeshesToPlanes". After this, Build in Unity (File>Build Settings) and, when finished, open the .sln generated in VS 2019, and (very important) compile using the Debug option, because if you do it in Release you will not see the bug correctly.
I have also added a Debug.Log to see if it is allowed to create plans, using CanCreatePlanes of SurfaceMeshesToPlanes, which checks if the whole project enables plane creation. In my case, the value it returns is True, but the next line, MakePlanes() throws the error mentioned in the first comment.
I didn't add MRTK using Feature Tool, I downloaded the Foundation and Tools package and added them manually in Unity (Assets>Import Package>Custom Package), I just installed Plane Finding using Feature Tool. I'm sorry I didn't mention this before.
If it helps, by doing a test to find out which line throws the error, I have been able to verify that the program stops at line 299 of SurfaceMeshesToPlanes.cs, inside the MakePlanes method, highlighted in blue.
Thank you so much
I fixed the bug by specifying the calling convention of the dll in PlaneFinding.cs.
I guess it would be a binding problem with the incompatibility of cdecl and stdcall, due to Il2Cpp and Unity. The issues #1784 and #2531 help me a lot. Maybe this is something that should be documented in case other people have the same bug.
Thanks again, have a nice day!
This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.
We appreciate your feedback and thank you for reporting this issue.
Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.
Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.
Please note that MRTK3 was released in August 2023. It features an all new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visithttps://www.mixedrealitytoolkit.org.
Thank you for your continued support of the Mixed Reality Toolkit!
Describe the bug
When instantiating a new SurfaceMeshesToPlanes object and making a call to the MakePlanes method, when compiling and running the application, it throws the following exception in the PlaneFinding.cpp class
Run-Time Check Failure #0 - The ESP value has not been saved correctly through a function call. This is usually the result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
To reproduce
or
Expected behavior
It was expected not to throw any error since the call to that method runs background task to create new plans based on data from mesh observers.
Screenshots
Your setup (please complete the following information)
Target platform (please complete the following information)
Additional context
The method CanCreatePlanes() returns True, so the system is ready to create the plans. All Spatial Awareness observers are configured by default with Legacy XR. This application is being exported from Unity 2017 and HoloToolkit to the commented configuration, so I need to use the makeplanes() method. In case it is not currently possible with the configuration I have, would there be any other solution?
Actually, I don't know if this is a MRTK code error or if I'm not coding it right. It seems to be a bug in the dll, but after checking the classes provided by MRTK with the function names and calls (SurfaceMeshesToPlanes.cs, Planefinding.cs), at a glance it seems to be all right, so I don't know where the bug is.
Thank you so much