简体   繁体   English

Unity Hololens(UWP)构建会产生独立构建不会出现的错误吗?

[英]Unity Hololens (UWP) build generates errors that Standalone builds do not?

Alternative titles: Unity References Bug for Hololens Windows UWP Builds (10.0.10586.0)? 替代标题:Hololens Windows UWP Builds的Unity References Bug(10.0.10586.0)? or..... Unity Hololens Builds have access to Standalone Build DLL references? 或者...... Unity Hololens Builds可以访问Standalone Build DLL引用吗?

Quick pre-text: I'm designing an app to run on the Hololens. 快速预文:我正在设计一个在Hololens上运行的应用程序。 The game plays perfectly fine inside of Unity. 这款游戏在Unity内部播放完美。 It builds perfectly fine to the PC, Mac & Linux Standalone platforms without error. 它可以毫无错误地构建到PC,Mac和Linux独立平台上。

However, errors from "missing" references arise when building to the Windows Store platform. 但是,构建到Windows应用商店平台时会出现“缺少”引用的错误。 (Missing is in quotes because I've thoroughly checked and rechecked that I'm using the right references and that they are located where they should be). (缺少是引号,因为我已经彻底检查并重新检查我正在使用正确的引用,并且它们位于它们应该位于的位置)。

Initial error on trying to build is: 尝试构建时的初始错误是:

Error building Player because scripts had compiler errors
error: The type or namespace name 'FileSystemEventArgs' could not be found (are you missing a using directive or an assembly reference?)
private void PrototypeFileWatcher_Created(object sender, FileSystemEventArgs e)
{
    ...
}

When this error is corrected by commenting out the aforementioned function and associated code, and building is attempted again, these errors come forth: 通过注释掉上述函数和相关代码来纠正此错误,并再次尝试构建时,会出现以下错误:

error: The name 'Console' does not exist in the current context
catch (Exception e)
{
    Console.WriteLine(e.Message);
}

error: Argument 1: cannot convert from 'string' to 'System.IO.Stream'
using (StreamReader sr = new StreamReader(path))
{
    ...
}

error: The type or namespace name 'BufferedStream' could not be found (are you missing a using directive or an assembly reference?)
using (BufferedStream bs0 = new BufferedStream(f0))
{
    ...
}

References are stored at the appropriate location: 参考文献存储在适当的位置:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Unity Full v3.5\System.Core.dll

References are listed in the heading of the scripts: 引用列在脚本的标题中:

using UnityEngine;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Threading;

With all that said. 尽管如此。 I've tried: 我试过了:

-Changing Api Compatibility Level*
-Changing the project solutions net framework
-#if NETFX_CORE using x = WinRTLegacy.x; #else
-#if WINDOWS_UWP using System; #endif
-Trashing the project entirely and rebuilding from scratch
-And lots more

Struggling with this issue for over a full day now. 现在为这个问题苦苦挣扎了整整一天。 I've NuGet pkgs, VS tools for Unity (otherwise known as VSTU), I'm using VS2015. 我有NuGet pkgs,用于Unity的VS工具(也称为VSTU),我正在使用VS2015。 I'm at a complete loss right now. 我现在完全失去了。 I'm not understanding if I can't build this to the Windows Store Platform as it can't use some of the DLLs that Unity standalone builds can? 我不明白我是否无法将其构建到Windows Store平台,因为它无法使用Unity独立版本可以使用的某些DLL?

HoloLens applications are constrained to using only what is a available in a UWP app. HoloLens应用程序仅限于使用UWP应用程序中的可用内容。 Some things will work in the Unity editor that do not work in a HoloLens Applications because the unity editor builds with mono instead of .net. 有些东西在Unity编辑器中可以在HoloLens应用程序中工作,因为统一编辑器使用单声道而不是.net构建。 You should constrain yourself to just things that work in UWP and they will work fine within the editor as well. 你应该将自己限制在UWP中工作的东西,它们也可以在编辑器中正常工作。 Even the full set of UWP API's are not yet available to work with on HoloLens. 即使是全套的UWP API也无法在HoloLens上使用。

The full documentation for UWP is here: UWP的完整文档如下:

https://docs.microsoft.com/en-us/uwp/api/ https://docs.microsoft.com/en-us/uwp/api/

The subset added specifically for HoloLens is at the bottom of this page: 专门为HoloLens添加的子集位于此页面的底部:

https://developer.microsoft.com/en-us/windows/mixed-reality/development https://developer.microsoft.com/en-us/windows/mixed-reality/development

Unfortunately there isn't a place that highlights what isn't available. 不幸的是,没有一个地方突出了不可用的东西。 The Visual Studio compiler will help you understand what is there and what is not. Visual Studio编译器将帮助您了解存在的内容和不存在的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM