Cube appears when plane detection is enabled

While using plane detection, occasionally a cube appears in the scene (I think at the scene origin). I’ve been able to reproduce this consistently but not predictably. I also scanned through the source code for the components attached to the PlaneDetector prefab but didn’t notice any obvious references to a unity cube primitive. Recently, It only seems to flash into view for a single frame or two, but in the past we’ve observed it for prolonged periods of time. I’ve been able to observe this in the HelloMR demo as well as my own project.

I’m now able to consistently reproduce this with the HelloMR demo. The cube appears briefly when the app first opens. So you can see this affect by repeatedly closing and reopening the app.

Hi, I tried several times, but there was no cube object appeared. Could you please tell me if there is any other related setting in your project?

No related settings that I can think of. I think I found the cause of the issue though. I am using the PolygonPlaneVisualizer component to manage the detected planes and there is a 0.2s wait at the beginning of a loop that runs for the duration of the components life. The relevant lines are line 60, WaitForSeconds wait = new WaitForSeconds(1f / 5);, and line 63, yield return wait; This yield appears at the beginning of the loop which means the plane mesh won’t get updated until 0.2 seconds after it is created, and it’s default state is apparently a cube. I think I was able to fix this just by moving the wait to the end of the loop, but it would be nice to have a fix for this in the next SDK update.

There is still another issue that needs to get solved here, which is, occasionally the cube appears and never goes away. I think this is due to the loop failing at some point before the mesh is ever updated. Hopefully you can look into this and get this resolved as well.

1 Like