HoloLens SpatialMapping not available - unity3d

I'm working on the tutorial MR Basics 101: https://learn.microsoft.com/en-us/windows/mixed-reality/holograms-101
And set everythings up as suggested in this article: https://learn.microsoft.com/en-us/windows/mixed-reality/install-the-tools
But when I download the Origami sample and open it in Unity in the recommended version 2018.3.X or the other recommended Version the LTS I get the error:
Assets\Holograms\Support\Spatial Mapping\SpatialMapping.cs(24,13): error CS0246: The type or namespace name 'SpatialMappingRenderer' could not be found (are you missing a using directive or an assembly reference?)
Only when I open it in the Unity Version 2017.2.5f1 it does work. Does that mean that only in that version the HoloLens package is available? Or do I have to install it seperatly for the newer versions?

This is a "bug" in later versions of Unity 2018 and above when importing projects with an older version where those 2 classes are not automatically imported. Just go to XR Settings under Player settings and uncheck/check "Virtual Reality Supported". That will re-download the missing classes.

If you use one of the older Mrtk-Versions you have to use the 2017 LTS-version of Unity. If you use MrtkVnext V1 or V2, you have to use Untiy 2018.
But all the tutorials from microsoft are done on Unity 2017 with the old Mrtk-Version, also known as HoloToolKit...there is some confusion regarding the naming.

Related

Missing type or namespace after installing MRTK Azure Spatial Anchor packet

I'm following this tutorial from Microsoft in order to setup a multi-users exeperience between an Hololens and an Android app.
The Issue
The issue is that after installing PUN-2 + MRTK.HoloLens2.Unity.Tutorials.Assets.GettingStarted.2.7.2 + MRTK.HoloLens2.Unity.Tutorials.Assets.MultiUserCapabilities.2.7.2 as stated in the tutorial I still end up with the following error :
Assets\MRTK.Tutorials.MultiUserCapabilities\Scripts\SharingModuleScript.cs(7,17): error CS0246: The type or namespace name 'AnchorModuleScript' could not be found (are you missing a using directive or an assembly reference?)
What I've tried
According to a similar post I tried to add the MRTK.HoloLens2.Unity.Tutorials.Assets.AzureSpatialAnchors.2.7.2 packet since it should be the missing piece but I ended up with even more missing types or names spaces like Azur or SpatialAnchorManager and other ones.
Config
I use Unity 2019.4.36f1 with MRTK 2.8.2.0
After testing, this project requires the following asset packages, you can try. It should be noted that for this project, the official document recommends using Unity 2020 LTS and MRTK 2.7.2. And for Mixed Reality development, the official currently recommends using Unity 2020.3 LTS, please refer to Choosing a Unity version and XR plugin - Mixed Reality | Microsoft Learn.
MRTK/Mixed Reality Toolkit Foundation
MRTK/Mixed Reality OpenXR Plugin
MRTK/Azure Spatial Anchors SDK Core
MRTK/Azure Spatial Anchors SDK for Windows
MRTK.HoloLens2.Unity.Tutorials.Assets.MultiUserCapabilities.2.7.2.unitypackage
MRTK.HoloLens2.Unity.Tutorials.Assets.GettingStarted.2.7.2.unitypackage
MRTK.HoloLens2.Unity.Tutorials.Assets.AzureSpatialAnchors.2.7.2.unitypackage
PUN 2 - FREE

MRTK Photon Unity Networking 'AnchorModuleScript' namespace not found

While following the mrtk tutorial on multi-user capabilities, there has been one CS0246 error that I haven't been able to avoid.
After importing PUN 2 from the asset store, all CS0246 errors from importing the MultiUserCapibilities package are resolved except for Assets\MRTK.Tutorials.MultiUserCapabilities\Scripts\SharingModuleScript.cs(7,17): error CS0246: The type or namespace name 'AnchorModuleScript' could not be found (are you missing a using directive or an assembly reference?).
I have followed this tutorial with my current project on Unity 2020.3.29f, the same project updated to Unity 2021, and a blank Unity 2020 LTS project following only the essential steps (switching build platform, importing MRTK foundation and OpenXR through the feature tool, and setting up MRTK and OpenXR in Unity). All of them only throw this one error. I also updated my Windows SDK and restarted my PC as many other solutions suggest.
My best guess is that this is something on Microsoft's end.
Windows 10 21H2 (OS Build 19044.1645)
Windows SDK version 2104 (10.0.20348.0)
Unity 2020.3.29f1
MRTK 2.7.3
OpenXR 1.4.0
Install this Unity package.
Microsoft assumes you've completed the 'Use Azure Spatial Anchors to anchor objects in the real world' tutorial (in which you download that package on the third page), which is part of the 'HoloLens 2 fundamentals' tutorials. It's also stated that having followed those tutorials is part of the prequisites to the multi-user capabilities tutorial: screenshot.
I've had the same problem, and just fixed it.
There are several packages that you need to install before adding the ones listed at mrtk tutorial on multi-user capabilities.
I solved it by installing the Unity packages of all the steps in HoloLens 2 fundamentals: develop mixed reality applications, you only need to get to the first 2 steps of each Learning Module and install by order their listed Unity Packages.
In short you need to follow the prerequisites to this tutorial.
At the end your Projects tab should look something like this: Screenshot
If you are getting errors from "using Microsoft.Azure.SpatialAnchors" and Azure not being found on imports. Try installing components from the Azure MixedReality Services tab from the MS Mixed Reality Feature Tool.
Before
AzureErrors Before
Imports for solution
Sucessfully found required imports in Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.4.2

Leap motion in MRTK

I tried all in this main step resource, but I cannot get leapmotion to work in MRTK.
I download the foundation packege with the Mixed Reality Feature Tool but I keep getting this error in the editor while making the leap motion profile:
And this when I trytointegrate the module:
On the other hand when the core packege isimported as adviced "Only import the Core package within the Unity Modules" these errors appear and the project does not compile:
Unity version: 2020.3.11.f1 and installer both installers Leap_Motion_Setup_4.0.0+52173 (orion) and Ultraleap_Tracking_Installer_5.4.5_win64.
The departing repo is: https://github.com/microsoft/MixedRealityToolkit-Unity
Which version of MRTK are you using?
I see you've tried both Orion (V4 service) and Gemini (V5 service).
You need to match the correct version of the Ultraleap Unity Modules / Plugin with the correct version of the Ultraleap tracking service (Orion/Gemini). Tracking Service version >=5.2 should be used with the Ultraleap Unity Plugin V5.3.0 (that exact version), although it will likely work with 4.9.1 of the Unity Modules too (I haven't personally tested this). This support is not yet in an MRTK release yet although it has been merged to main (https://github.com/MicrosoftDocs/mixed-reality/pull/512).
The update to the MRTK documentation to support the Ultraleap Unity Plugin V5 (requires V5.3.0 plugin) is in this pull request: https://github.com/MicrosoftDocs/mixed-reality/pull/512 and is worth a read.
Note, we talk about the V4 Unity code as Unity Modules and V5 Unity code as the Unity Plugin.
If you need to use the Orion tracking service then you need a Unity Modules version that is older than V4.9.1 - i.e. Unity Modules 4.8.0 from here https://github.com/ultraleap/UnityPlugin/releases/tag/UM-4.8.0
Sounds like you might still be having issues using Orion and Unity Modules - can you confirm the version of MRTK and Unity Modules you were trying to use please?
Summary:
Orion Service V4.X : Use <=V4.8.0 of the Unity Modules
Gemini Service >= V5.2 : Use V4.9.1 of the Unity Modules or 5.3.0 of the Unity Plugin (support for the latter is not in an MRTK release but has been merged to main)

(Impossible) HtmlAgilityPack not found in Unity

I have a problem with the HtmlAgilityPack...
I have correctly imported the pack in Visual Studio (References > Manage NuGet Packages > Browse, and just installed the package)
In Unity I get this error:
Assets/Scripts/Searcher.cs(13,7): error CS0246: The type or namespace name 'HtmlAgilityPack' could not be found. Are you missing an assembly reference?
I didn't forgot two add using HtmlAgilityPack; in my script
Using ? :
- Unity 2017.2.1f1
- Microsoft Visual Studio Community 2015
- HtmlAgilityPack 1.6.13
Not sure why this was marked impossible. You can do this by simply dropping HTMLAgilityPack.dll into Unity. Unity will recognize the library and make it available in VS2017.
Here's what it looks like in Unity when imported correctly.
I am on (Experimental .Net 4.6), but I doubt that makes a difference.
Based on a similar question over on Unity Answers:
Unity itself is incapable of handling Nuget packages, they're more of a VS thing. But as long as the assembly targets .NET 2.0 you should be able to use the .dll in Unity without issue
I can't find any information on what version of .NET that HtmlAgilityPack targets, but my guess is that it isn't the same as what Unity uses. By default Unity 2017 uses the .NET 3.5 runtime with an option to switch to the experimental 4.6 runtime.
The best compatibility will be with both targetting the same version, but in the case of it differing, Unity will need to be newer as if the dll uses features added by (say) .NET 4.6 and Unity's set to use .NET 3.5, Unity won't be able to handle those calls.
Try changing to the .NET 4.6 experimental runtime and seeing if that works.
Under Edit -> Project -> Player:

Unity 2017 UnityContainer will not resolve

I am having a ton of trouble trying to use UnityContainer. Unity will not compile my scripts as it keeps giving me this message :
The type or namespace name `Unity' could not be found. Are you missing an assembly reference?
And
The type or namespace name `UnityContainer' could not be found. Are you missing an assembly reference?
I have been digging around on the web for ages, and have found some people with similar, but not exactly the same problem. So far I have tried :
Uninstalling / Reinstalling Unity (2017.3.0f3)
Uninstalling / Reinstalling Visual Studio ( 2017 )
Changed unity player settings to use Experimental .NET 4.6 equivilant
I have used NuGet to install the Unity Container project, and everything resolves and builds fine in Visual Studio, but Unity keeps giving the missing Namespace error.
I am completely stuck, and at a bit of a loss because I need to use the features UnityContainer provides in order to progress with my game. I have considered using an older version of Unity, but I really want to use the new tilemaps feature. I would be incredibly grateful for any assistance.