Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

NullExceptions when setting DrawVisualMeshes in SpatialMappingManager

Hello Holofriends,

I'm trying to trigger the spatial meshes on and off by setting the DrawVisualMeshes to true or false, but by doing so, I get NullExceptions in the UpdateRendering function it calls.

private void UpdateRendering(bool Enable)
{
      List<MeshRenderer> renderers = Source.GetMeshRenderers();
      for (int index = 0; index < renderers.Count; index++)
      {
          renderers[index].enabled = Enable;
          if (Enable)
          {
               renderers[index].sharedMaterial = SurfaceMaterial;
          }

      }
}

Most of the time, there is some of the objects in "renderers" that are null and that throws an exception. Doing that make it that all the renderers before the null have the modification and all the others don't, essentially making parts of the mapping mesh still shown when you disable it.

Any clues on what I'm missing here?

Thanks!

Best Answer

Answers

  • Options

    that's a legit bug in the script. renderers[index] should be checked for null before accessing.

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

  • Options

    Why is it possible for the renderers' list to contains null references? Shouldn't the spatial mapping updates itself to clear those? Maybe this bug is somewhat related to this one? http://forums.hololens.com/discussion/1517/observer-memory-growing-indefinitely

Sign In or Register to comment.