Meshing Example

Give us as much detail as possible regarding the issue you're experiencing.

Unity Editor version: 2022.2.0f1
ML2 OS version: 1.3.0 dev2 (secure)
MLSDK version: 1.3.0 dev2
Host OS: Windows

Error messages from logs (syntax-highlighting is supported via Markdown): I have a question about this example. How can I remove all the other functions other than the occlusion? Can I just simply delete the "MeshingVisualizer" and "MeshingSubsystemComponent"? And also deleted other render mode and shooting prefab in the "MeshingExample" script?

Hi @ineedhelpty,

The mode switching functionality can be found in MeshingVisualizer.cs

public void SetRenderers(RenderMode mode)
            if (renderMode != mode)
                // Set the render mode.
                renderMode = mode;

                _meshingSubsystemComponent.requestedMeshType = (renderMode == RenderMode.PointCloud) ? 
                    MeshingSubsystemComponent.MeshType.PointCloud : 

                switch (renderMode)
                    case RenderMode.None:
                    case RenderMode.Wireframe:
                        _meshingSubsystemComponent.PrefabRenderer.sharedMaterial = _wireframeMaterial;
                    case RenderMode.Colored:
                        _meshingSubsystemComponent.PrefabRenderer.sharedMaterial = _coloredMaterial;
                    case RenderMode.PointCloud:
                        _meshingSubsystemComponent.PrefabRenderer.sharedMaterial = _pointCloudMaterial;
                    case RenderMode.Occlusion:
                        _meshingSubsystemComponent.PrefabRenderer.sharedMaterial = _occlusionMaterial;
                        throw new ArgumentOutOfRangeException($"unknown renderMode value: {renderMode}");


If you delete the MeshingSubsytemComponent, the example will not work.



Hi, thanks for the response. Can I delete "MeshTexturedWireframeAdapter" if I'm not using the wireframe render mode?

For this, I recommend creating a git repository and making changes that can be reverted to a previous state so you can edit the project with peace of mind.

To answer your question, yes you can delete this component and it will still work as long as you don't use the wireframe material.

1 Like

Hi @etucker The occlusion stopped working after I disabled "MeshTexturedWireframeAdapter" in the inspector. Do you know if there is any reason causing this problem? Thanks

@etucker This is a separate question from the previous one. In 'MeshingVisualizer', I saw the default mode is Wireframe.
With nothing else changed, I tried to set the default mode as occlusion but occlusion stopped working.
My only change is:

public RenderMode renderMode
            get; private set;
        } = RenderMode.Occlusion;


Hi @ineedhelpty

You do not need the Wireframe adapter to have the meshing display the occlusion material. Additionally, Please see the Meshing example in the Magic Leap Unity Example's project to learn how to set the render mode and materials.

See MeshingVisualizer.cs to learn how the material is applied and the MeshingExample.cs script to see how to set the render mode.

Thank you. I realized I need to change the mesh prefab in MeshingSubsytemComponent