Fix holograms no longer showing up in pictures taken with the HoloLens 2

Fix holograms no longer showing up in pictures taken with the HoloLens 2

Whether the picture is taken via the application or the HL shell.

Recently I ran into an issue with holograms not appearing in images taken via my HL2 application or using the shell "Take a picture". I had recently upgraded some plugins and upgraded MRTK from 2.7.2 to 2.7.3 so I was unsure exactly what was causing the issue. Other apps would show their holograms so it was something wrong with my application only.

Technologies used:

  • Unity 2020.3.13

  • MRTK 2.7.3 (previously 2.7.2)

  • Visual studio 2019

I still don't know what exactly caused this part of code to now do the opposite of it's original intended purpose, but this is what was causing them to not show. I had spent many hours reverting each plugin/MRTK to the previous version attempting to get this working again.

#if WINDOWS_UWP
    var holoDisplay = Windows.Graphics.Holographic.HolographicDisplay.GetDefault();
    var holoView = holoDisplay.TryGetViewConfiguration(Windows.Graphics.Holographic.HolographicViewConfigurationKind.PhotoVideoCamera);
    if (holoView != null)
        holoView.IsEnabled = true;
#endif

This snippet of code is a year or 2 old so it was assumed to still be working. All I had to do was remove this code and then holograms would appear in pictures again. I hope this can help others in the future!

If anyone knows why this now prevented holograms from showing in pictures, I would love to know!