Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)? or..... Unity Hololens Builds have access to Standalone Build DLL references?

Quick pre-text: I'm designing an app to run on the Hololens. The game plays perfectly fine inside of Unity. It builds perfectly fine to the PC, Mac & Linux Standalone platforms without error.

However, errors from "missing" references arise when building to the Windows Store platform. (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. 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?

like image 492
jtth Avatar asked Mar 17 '26 13:03

jtth


1 Answers

HoloLens applications are constrained to using only what is a available in a UWP app. 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. You should constrain yourself to just things that work in UWP and they will work fine within the editor as well. Even the full set of UWP API's are not yet available to work with on HoloLens.

The full documentation for UWP is here:

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

The subset added specifically for HoloLens is at the bottom of this page:

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.

like image 190
Cameron Vetter Avatar answered Mar 19 '26 02:03

Cameron Vetter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!