小编Ale*_*lex的帖子

Unity Hololens2 构建错误

我尝试构建 Hololens 2 应用程序,但遇到无法解决的错误。当我尝试使用 Unity 播放按钮测试应用程序时,它按预期工作。我还尝试了 MRTK 示例场景,它也只能通过播放按钮起作用,但当我尝试构建它时却不起作用。

构建错误:

Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@251fc689f36f\Providers\WindowsMixedReality\XRSDK\WindowsMixedRealityDeviceManager.cs(404,128): error CS0104: 'Handedness' is an ambiguous reference between 'Microsoft.MixedReality.Input.Handedness' and 'Microsoft.MixedReality.Toolkit.Utilities.Handedness'
Run Code Online (Sandbox Code Playgroud)
Error building Player because scripts had compiler errors
Run Code Online (Sandbox Code Playgroud)
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <1135c66e5f4c41a7831fa5798849d8b6>:0 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <1135c66e5f4c41a7831fa5798849d8b6>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Run Code Online (Sandbox Code Playgroud)

我尝试使用 MixedRealityFeatureTool 更新 MRTK,并按照教程中所述进行混合现实工具包设置。但我仍然收到错误,这意味着我无法在 Hololens 2 上测试它。

c# unity-game-engine hololens

4
推荐指数
1
解决办法
1234
查看次数

使用 async/await 的技巧

最近几天我一直在阅读C# 异步编程。原因是 UWP 中的文件选择器(这是必要的,因为我正在 Unity 中为 Hololens 2 编程)。尽管有很多来源,即123,但我对正确使用有一些理解问题,也许这里有经验的用户可以给我一些提示。

我正在尝试做的一个例子:

程序开始:

public class SceneUIHandler : MonoBehaviour
{
  openFile()
  {
    pickFile(); // calls await filepicker.PickSingleFileAsync();
    loadData(path); // calls FileLoader.loadFile with path from filepicker for the reader
    showData(); // should display the data
  }
}
Run Code Online (Sandbox Code Playgroud)

装载机:

public class FileLoader:
    {
      async void loadFile(string path)
      {
        Task<StreamReader> streamReaderTask = getStreamReader(filePath);
        StreamReader sr = await streamReaderTask;
        // after that read file with the StreamReader...
        ...
      } …
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine async-await uwp hololens

2
推荐指数
1
解决办法
1043
查看次数

标签 统计

c# ×2

hololens ×2

unity-game-engine ×2

async-await ×1

uwp ×1