无法将拍摄的照片保存在hololens应用程序中

问题描述 投票:0回答:1

我正在尝试在我的

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

名称 WINDOWS 在上下文中不存在。

请任何人帮助我。预先感谢。

unity-game-engine hololens
1个回答
2
投票

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

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

另外不要忘记在播放器设置下启用图片库权限

© www.soinside.com 2019 - 2024. All rights reserved.