Meshing not working if mesh chunk has no material

Include the following details while filing a bug report (edit as applicable):

  • Issue category: Real-time Mapping-Depth
  • Device type & OS version: Android 12, Sony Xperia 1 II
  • Host machine & OS version: Mac / Windows 10
  • Issue Environment : On Device
  • ARDK version: 1.3.1
  • Unity version: 2021.3.2f1

Bug reproduction steps:
Setup meshing scene (using URP if needed)
Go to mesh chunk prefab
Remove material from mesh renderer

meshing stops working

Removing materials would be very beneficial for performance, so why does this break meshing

I know, it’s not optimal for performance improvement, what you are probably looking for, but as a workaround, you could maybe set the “Use Invisible Material” checkbox in the ARMeshManager, to make it at least not visible anymore.

I already use an unlit material, which is opaque with cutoff, so performance is good. But having no material shouldn’t throw errors in my opinion

Yes, i agree. Just guess, they probably made it, because it seems it is based on a MeshRenderer. And when you don’t assign any Material Unity usually renders that in pink. So probably they wanted to show an error instead, to identify it easier on development time… :thinking:

1 Like

MeshRenderer is not required to generate a mesh.
If there is no shared material ot does not show anything at all, which is good for performance. If you put it at null it does become pink

That’s actually true. So, easiest solution/workaround would just be, disabling (or completely removing) MeshRenderer component from the mesh prefab

Might try, but might give the same error

Hi @Dylan_Smit, is the issue here that there is an error being thrown (see below), or that the mesh isn’t being generated? I followed your steps with the Meshing example scene, and while the mesh wasn’t being rendered, it still seemed that there was mesh being generated (given the number of blocks and vertices increasing in the counter at the top of the screen, as would be expected when mesh is generated).

#Niantic.ARDK.Extensions.Meshing.MeshObjectsGenerator#: Failed to change the mesh material because the mesh prefab's MeshRenderer component lacks a shared material.
UnityEngine.Debug:LogError (object)
Niantic.ARDK.Utilities.Logging.UnityARLogHandler:Error (string) (at Assets/ARDK/Utilities/Logging/LogHandler/UnityARLogHandler.cs:41)
Niantic.ARDK.Utilities.Logging.ARLog:_Error (string) (at Assets/ARDK/Utilities/Logging/ARLog.cs:198)
Niantic.ARDK.Extensions.Meshing.MeshObjectsGenerator:SetUseInvisibleMaterial (bool) (at Assets/ARDK/Extensions/Meshing/MeshObjectsGenerator.cs:131)
Niantic.ARDK.Extensions.Meshing.ARMeshManager:SetUseInvisibleMaterial (bool) (at Assets/ARDK/Extensions/Meshing/ARMeshManager.cs:357)
Niantic.ARDK.Extensions.Meshing.ARMeshManager:ListenToSession () (at Assets/ARDK/Extensions/Meshing/ARMeshManager.cs:274)

Hey,
I apparently had another issue that was fixed by reinstalling the app fully (not clicking build and run).
If this error is not feature breaking I recommend making it a Logwarning instead of LogError

1 Like

Good callout @Dylan_Smit, I’ll look into whether or not this actually feature breaking, and if it’s not I’ll make sure to forward the suggestion to the dev team to lower it to a warning.

2 Likes