Start a new topic

Spatial Meshing Sample issue

Hi, I am trying to update mesh visual by ARMeshManager update.

But I found an issue which in 
SpatialMeshingSampleController.cs of the Samples.

 

void OnMeshesChanged(ARMeshesChangedEventArgs args) {
            ...
            foreach (var meshFilter in args.updated) {
                Debug.Log("Updated meshFilter: " + meshFilter.name);
            }
            ...
        }

The environment meshes are generated well.
But the mesh update log will show: Info Unity Updated meshFilter: Mesh 0000000000000000-0000000000000000

So the mesh information is not get correctly, then I could not set which mesh is updated.

Does anyone have the same issue, or there is any solution for this issue?

I am testing on SDK 0.12.1, and Spaces services already also 0.12.1


Hi Mao,


this is expected behavior. As there is currently only one mesh, it is the only one being updated, and it has the id 0000000000000000-0000000000000000.

You do not need to update the mesh yourself. That happens in the background. Turning off the updates would defacto mean disabling all mesh updates. 


Do you have some special use case that would require splitting the mesh?

Hi Simon,

I want to try using mesh to show wireframe as ARFoundation Wireframe demo.

https://github.com/Unity-Technologies/arfoundation-demos/blob/master/Assets/Shaders/Wireframe/Scripts/BarycentricMeshData.cs

The sample script will split mesh while mesh updated.

But using the id 0000000000000000-0000000000000000 will be showed no mesh of this id.

Is there any solution for such use case?

Hi Mao, 


are you saying the MeshFilter within that iteration is null? Are you getting an exception or any other error in the log for that?  If so I would need to create a bug report for that. 


As a workaround I would suggest to get the mesh directly from the ARMeshManager like this in the method callback registered to ARMeshManager.meshesChanged.

MeshFilter mesh = ARMeshManager.meshes.Count > 0 ? ARMeshManager.meshes[0] : null;

This only works when you know there is only one mesh which is currently the case for spaces. 


If you want to make sure you can also iterate over ARMeshManager.meshes instead of args.updated which will have some overhead but should work even if there is more than one mesh in the future. 




Login or Signup to post a comment