2017-04-20 90 views
0

我正在使用HoloLens和Unity,并尝试拍照。PhotoCapture.CreateAsync()从未执行

我有同样的问题,因为在这个讨论 https://forums.hololens.com/discussion/897/locatable-camera-known-issue-photocapture-createasync-doesnt-start

此代码在MonoBehaviour在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"); 
    } 
} 

打印输出:

CreateAsync start 
None 
UnityEngine.Resolution[] 
END 

这里是我的“功能“Package.appxmanifest的一部分:

<Capabilities> 
    <Capability Name="internetClient" /> 
    <uap2:Capability Name="spatialPerception" /> 
    <DeviceCapability Name="webcam" /> 
    <DeviceCapability Name="microphone" /> 
</Capabilities> 

这里是日志的“模块信息”部分:

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)' 

你明白我的问题? 其他一些脚本可以阻止执行吗?

+0

有了一些断点,我有这个错误:代码到达时无法初始化IMediaCapture':PhotoCapture.CreateAsync() –

回答

0

在hololens:

Settings/Privacy/Camera/"Let apps use my camera" => ON

它的作品... 我想在这种情况下,有一个显式的错误消息。