I am trying to build a project in Unity3D which uses the Kinect v2 for The Windows store. To build a windows store app from unity it 1st builds a visual studio project from which you then build the final app. I am getting errors when I try to build the visual studio project.
Some guys seem to have figured it out for Unity 4 here, Though I have tried everything they suggested and read through all the posts and links in great detail yet I am still having the same error.
Here is my error
"
First-chance exception at 0x76004598 in Template.exe: Microsoft C++ exception: Platform::ClassNotRegisteredException ^ at memory location 0x0643F1C0. HRESULT:0x80040154 Class not registered
WinRT information: Class not registered
Stack trace:
combase.dll!76727455()
vccorlib120_app.dll!5003a438()
vccorlib120_app.dll!5003b337()
KinectUnityAddin.dll!50061296()
KinectUnityAddin.dll!500745af()
KinectUnityAddin.dll!50062eef()
If there is a handler for this exception, the program may be safely continued.
"
Which VS version are you on?
I’ve tried these two versions of VS
Which steps did you try from the other thread? You’re probably missing references in project and manifest.
So the last post there gives the instructions which I have followed [I’ll add my own interpretation + additional info in square brackets]
To get my Unity app with the Kinect package to export and work in windows store I do this…
-In Unity build project as 8.1 w/ C# projects
[SDK is set to 8.1 and I tick the box for Unity c# Projects, also in Unity 5 I set the dll in the metro folder to build for WSAPlayer and set others for editor /standalone]
-Make sure apppackage.manifest has webcam and mic capabilities
[I tick webcam and mic in player settings, publishing settings, capabilities ]
-Add references to KinectPreview extension to the two supporting projects in my solution
[I add a reference to this file.
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\WindowsPreview.Kinect\2.0\References\CommonConfiguration\neutral\WindowsPreview.Kinect.winmd
to the two projects…
Assembly-CSharp-metro-vs2013
and
Assembly-CSharp-firstpass-metro-vs2013
]
-Change build configuration to x86 on the two supporting projects and in the configuration manager
[If I set the active solution platforms to x86 in the dropdown box in the menu bar of visual studio the projects also change to x86]
-Run and smile
[run, get same error, do not smile ]
This is wrong. You’re supposed to add those references to the main project Unity generates, not the ones that have your scripts. It will be named after your project.
Ok When i do that I get 21 errors and 1180 warnings
Two of the errors look like this
Severity Code Description Project File Line
Error The command ““C:\BUILDS\Help2\Unity\Tools\SerializationWeaver\SerializationWeaver.exe” “C:\Github\MS_Kinect\obj\Store 8.1\x86\Debug\x86\Debug\Assembly-CSharp-firstpass.dll” -pdb -verbose -unity-engine=“C:\BUILDS\Help2\MSKinect\Unprocessed\UnityEngine.dll” “C:\Github\MS_Kinect\obj\Store 8.1\x86\Debug\x86\Debug”” exited with code 1. Assembly-CSharp-firstpass-metro-vs2013 C:\Github\MS_Kinect\Assembly-CSharp-firstpass-metro-vs2013.csproj 135
Severity Code Description Project File Line
Error The command ““C:\BUILDS\Help2\Unity\Tools\SerializationWeaver\SerializationWeaver.exe” “C:\Github\MS_Kinect\obj\Store 8.1\x86\Debug\x86\Debug\Assembly-CSharp.dll” -pdb -verbose -unity-engine=“C:\BUILDS\Help2\MSKinect\Unprocessed\UnityEngine.dll” “C:\Github\MS_Kinect\obj\Store 8.1\x86\Debug\x86\Debug”” exited with code 1. Assembly-CSharp-metro-vs2013 C:\Github\MS_Kinect\Assembly-CSharp-metro-vs2013.csproj 140
and the others look like this…
Severity Code Description Project File Line
Error Cannot resolve Assembly or Windows Metadata file ‘WindowsPreview.Data.winmd’ MSKinect C:\BUILDS\Help2\MSKinect\MSKinect.csproj
Btw one weird thing I noticed in VS 2015 is that in the properties of the WindowsPreview.Kinect reference, when added to the project, in its properties its Version is 255.255.255.255 which seems odd.
Also the project I am trying to build is the example Unity / Kinect project provided by Microsoft
Thanks a lot for looking at this issue btw @Tautvydas-Zilys . I dont think I’ve ever had a “Unity Technlogies” reply before.
I was thinking what would be a great help would be if you could confirm that you can successfully build the Microsoft Kinect Unity example project from Unity 5 to Windows store yourself. And if so post more detailed instruction on how to do so. In that case I will know what I’m supposed to do in order to get it to work and can work towards that.
The error is fairly self explaining: it cannot find WindowsPreview.Data.winmd - is the file on disk?
One more thing: when building from Unity, uncheck C# projects. They are known to cause issues with plugins: we have an active bug on them.
I sorted this issue btw…
The issue was I was adding the references wrong. I was going- add reference\browse and then would browse to and select the .winmd file
eg. C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\WindowsPreview.Kinect\2.0\References\CommonConfiguration\neutral\WindowsPreview.Kinect.winmd
The correct way to add the reference is to go- add reference\Windows8.1\Extensions\ then tick the box for the required reference assembly.
Thanks for your help!
The build process for Unity 5 is simpler than the one worked out by the guys for Unity 4 here
- Set up the dll in metro folder to build for WSAPlayer
- Tick microphone and webcam boxes in player settings, publishing settings, capabilities
- Build for windows 8.1 (do not tick C# project box)
- One project will be created in the VS solution. Right click on references\ add reference\Windows8.1\Extensions\ then tick the box for WindowsPreview.Kinect (x86 windows 8.1 version)