Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. And always feel free to hit us up on Twitter @MxdRealityDev.

OnPhotoCaptureCreated not called when running in Hololens

I am trying to make an app that would capture photos in Hololens. I have followed the tutorial and almost copied the tutorial code. When I run it on my computer in Unity it works and takes a photo with my webcam. But when I run it on Hololens it doesn't work.
My problematic part of code is here:

void Start() {

    startHeadPosition = Camera.main.transform.position;
    newHeadPosition = startHeadPosition;
    dIndikator.text = "";


    Debug.Log("\n Taking picture \n");
    PhotoCapture.CreateAsync(false, OnPhotoCaptureCreated);
    Debug.Log("\n Debug 2 \n");

void OnPhotoCaptureCreated(PhotoCapture captureObject)
    Debug.Log("\n Debug 1 \n");
    photoCaptureObject = captureObject;

    m_cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).Last();

    CameraParameters c = new CameraParameters();
    c.hologramOpacity = 0.0f;
    c.cameraResolutionWidth = m_cameraResolution.width;
    c.cameraResolutionHeight = m_cameraResolution.height;
    c.pixelFormat = CapturePixelFormat.JPEG;

    Debug.Log("\n PhotoModeStarted \n");

    captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);

In Unity the log looks like this:
Taking picture
Debug 2
Debug 1

But when in Hololens I get only:
Taking picture
Debug 2

So it looks like it doesn't even enter the OnPhotoCaptureCreated. I have set capabilities to the camera and microphone and made sure I have them in the manifest file so I don't have any idea what would have caused this problem.
Any ideas are greatly appreciated.


  • I think I've noticed issues with PhotoCapture.SupportedResolutions not actually containing any resolutions (and throwing an exception). You could try hardcoding the photo width and height to something like 1280x720 and see if that works.

Sign In or Register to comment.