2017-04-20 40 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

它的作品... 我想在這種情況下,有一個顯式的錯誤消息。