问题
I'm using the HoloLens and Unity and I try to take a photo.
I have the same problem as in this discussion https://forums.hololens.com/discussion/897/locatable-camera-known-issue-photocapture-createasync-doesnt-start
This code in a MonoBehaviour in Unity :
void Start() {
Debug.LogError("CreateAsync start");
Debug.LogError(WebCam.Mode);
Debug.LogError(PhotoCapture.SupportedResolutions);
foreach (Resolution resolution in PhotoCapture.SupportedResolutions) {
Debug.LogError(resolution);
}
Debug.LogError("END");
PhotoCapture.CreateAsync(false, delegate (PhotoCapture captureObject) {
Debug.LogError("CreateAsync done");
}
}
Print this output :
CreateAsync start
None
UnityEngine.Resolution[]
END
Here is my "Capabilities" part of the Package.appxmanifest :
<Capabilities>
<Capability Name="internetClient" />
<uap2:Capability Name="spatialPerception" />
<DeviceCapability Name="webcam" />
<DeviceCapability Name="microphone" />
</Capabilities>
Here is the "Module information" part of the log :
Module information:
Built with Compiler Ver '190023918'
Built from '5.5/release' branch
Version is '5.5.3f1 (4d2f809fd6f3)'
Release build
Application type 'D3D11'
Used 'UWP'
OS 'Windows 10 (10.0.14393)'
Do you see my problem ? Can some other script block the execution ?
回答1:
On the hololens :
Settings/Privacy/Camera/"Let apps use my camera" => ON
It's works... I wish there was an explict error message in this case.
来源:https://stackoverflow.com/questions/43519326/photocapture-createasync-never-executed