I am trying to have the meshing subsystem mesh toggle between being transparent and not transparent with the menu button . However I find that only some of the mesh is getting changed. Most of the mesh remains in the original color/opacity. It's as if multiple instances of the Mesh Prefab are being created and used...? Any suggestions on how to change all of the mesh? Thank you.
Here's my code to toggle the mesh opacity:
private void HandleOnMenu(InputAction.CallbackContext obj)
{
Renderer r = meshController.GetComponent<MeshingSubsystemComponent>().meshPrefab.GetComponent<Renderer>();
if (r.material.color.a == 0.0f) {
r.material.color = new Color(1,1,1, 2.0f/255.0f);
} else {
r.material.color = new Color(1,1,1, 0.0f);
}
}
Unity Editor version: 2022.3.12f1
ML2 OS version: 1.4.1
Unity SDK version: 1.12.1
Host OS: MacOS