【问题标题】:Unable to save the captured photo in hololens app无法将拍摄的照片保存在 hololens 应用程序中
【发布时间】:2018-05-30 04:44:50
【问题描述】:

我正在尝试在我的hololens 应用程序中拍摄一张照片。它正在工作,但它将图像保存在设备门户中。我想将图像保存在 hololens 应用程序中,以便我可以在 hololens 上的照片中看到它。我已将文件路径指定为:string filePath = System.IO.Path.Combine(Windows.Storage.KnownFolders.PicturesLibrary.Path, filename); 用于将照片存储在 hololens 应用程序中,但这里出现错误:

上下文中不存在名称 WINDOWS。

请任何人帮助我。提前致谢。

【问题讨论】:

标签: unity3d hololens


【解决方案1】:

您需要在文件路径变量中添加 if/endif 语句,因为 Windows 命名空间仅在 HoloLens 上存在,而在 Unity 中不存在。像这样的:

#if WINDOWS_UWP
    filePath = Path.Combine(Windows.Storage.KnownFolders.CameraRoll.Path, filename);               
#endif

另外别忘了在播放器设置下开启图片库权限

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-11
    • 2013-06-19
    • 1970-01-01
    • 2011-09-30
    • 1970-01-01
    相关资源
    最近更新 更多