Anyone tried KinectV2 for Windows plugin? Then build it to Windows Store?

I’m having a problem building my Unity Kinect v2 app to Windows Store.

It says:

First-chance exception at 0x76064598 in Template.exe: Microsoft C++ exception: Platform::ClassNotRegisteredException ^ at memory location 0x07A8F63C. HRESULT:0x80040154 Class not registered

WinRT information: Class not registered

Stack trace:
[External Code]
KinectUnityAddin.dll!11a91296()
KinectUnityAddin.dll!11aa45af()
KinectUnityAddin.dll!11a92eef()
[External Code]

If there is a handler for this exception, the program may be safely continued.

Any Ideas? Thanks in advance.

This error means the assembly was not added to AppXManifest.xml file. This maybe related to recent bug introduced in Visual Studio 2013 Update 4, if you’re not using this update, maybe you incorrectly added the library to the project

Thank you @Tomas1856

I even tried it to Update 3, same thing happens. I also tried to changed the debug architecture to x86, it runs smoothly but there’s no color image display or Kinect Tracking.

If ever how can I add the assembly to AppXManifest.xml?
Or how do I properly export Unity App with plugin/s to Windows Store?
Sorry for the noob question.

P.S. I’m using Visual Studio 2013 Update 4

Check - http://forum.unity3d.com/threads/windows-8-1-system-typeloadexception-when-adding-sdks.283454/#post-1890303 thread… though people say it doesn’t work completely, you could try adding those lines to Package.appxmanifest… though I am not sure if that’ll work

Check the documentation regarding plugins, but basically you have to a dummy plugin for Editor, and the real plugin for Windows Store.

http://docs.unity3d.com/Manual/windowsstore-plugins.html

There’s also WP8 documentation which has some useful info as well, as the workflow is pretty similar

http://docs.unity3d.com/Manual/wp8-plugins-guide-csharp.html

If you can’t get it work, please submit a bug report with small repro attached, I’ll take a look.

But as it stands, you’ll probably won’t be able to properly move forward, until new Visual Studio 2013 update is released.

I will try this @Tomas1856 Thank you!

Hey @Tomas1856 ,
I am experiencing the same error trying to run a windows store app with the kinectv2 unity plugin. I am unsure what a correct AppXManifest.xml looks like with KinectUnityAddin.dll referenced. I do not see KinectUnityAddin referenced in my appx at all. Could someone post a correct AppXManifest.xml with the reference? @mangjoey123 were you able to resolve this issue?

VS 2013.3
VS 2013.4

Unity 4.6

My Error

First-chance exception at 0x76F42F71 in Template.exe: Microsoft C++ exception: Platform::ClassNotRegisteredException ^ at memory location 0x092BF3B8. HRESULT:0x80040154 Class not registered

WinRT information: Class not registered

Stack trace:
[External Code]
KinectUnityAddin.dll!09c01296()
KinectUnityAddin.dll!09c145af()
KinectUnityAddin.dll!09c02eef()
[External Code]

If there is a handler for this exception, the program may be safely continued.

Here is my AppxManifest from bin/debug/AppX

<?xml version="1.0" encoding="utf-8"?>
<Package xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:build="http://schemas.microsoft.com/developer/appx/2012/build" IgnorableNamespaces="build">
  <!--
    THIS PACKAGE MANIFEST FILE IS GENERATED BY THE BUILD PROCESS.

    Changes to this file will be lost when it is regenerated. To correct errors in this file, edit the source .appxmanifest file.

    For more information on package manifest files, see http://go.microsoft.com/fwlink/?LinkID=241727
  -->
  <Identity Name="TestKinectWinStore" Publisher="CN=DefaultCompany" Version="1.0.0.0" ProcessorArchitecture="x86" />
  <Properties>
    <DisplayName>TestKinectWinStore</DisplayName>
    <PublisherDisplayName>DefaultCompany</PublisherDisplayName>
    <Logo>Assets\StoreLogo.png</Logo>
  </Properties>
  <Prerequisites>
    <OSMinVersion>6.3.0</OSMinVersion>
    <OSMaxVersionTested>6.3.0</OSMaxVersionTested>
  </Prerequisites>
  <Resources>
    <Resource Language="EN-US" />
  </Resources>
  <Applications>
    <Application Id="App" Executable="Template.exe" EntryPoint="TestKinectWinStore.App">
      <m2:VisualElements DisplayName="TestKinectWinStore" Square150x150Logo="Assets\MediumTile.png" Square30x30Logo="Assets\SmallLogo.png" Description="TestKinectWinStore" ForegroundText="light" BackgroundColor="#000000">
        <m2:smile:efaultTile Wide310x150Logo="Assets\WideTile.png" DefaultSize="square150x150Logo"></m2:smile:efaultTile>
        <m2:SplashScreen Image="Assets\SplashScreen.png" />
      </m2:VisualElements>
    </Application>
  </Applications>
  <Capabilities>
    <DeviceCapability Name="webcam" />
    <DeviceCapability Name="microphone" />
  </Capabilities>
  <Dependencies>
    <PackageDependency Name="Microsoft.VCLibs.120.00.Debug" MinVersion="12.0.21005.1" />
  </Dependencies>
  <Extensions>
    <Extension Category="windows.activatableClass.inProcessServer">
      <InProcessServer>
        <Path>UnityEngineDelegates.dll</Path>
        <ActivatableClass ActivatableClassId="UnityEngineDelegates.PlatformInvoke" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="UnityEngineDelegates.FunctionDefsDictionary" ThreadingModel="both" />
      </InProcessServer>
    </Extension>
    <Extension Category="windows.activatableClass.inProcessServer">
      <InProcessServer>
        <Path>UnityPlayer.dll</Path>
        <ActivatableClass ActivatableClassId="UnityPlayer.XamlPageAutomationPeer" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="UnityPlayer.StreamListenerContext" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="UnityPlayer.MulticastSocketContext" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="UnityPlayer.AppCallbacks" ThreadingModel="both" />
      </InProcessServer>
    </Extension>
    <Extension Category="windows.activatableClass.inProcessServer">
      <InProcessServer>
        <Path>CLRHost.dll</Path>
        <ActivatableClass ActivatableClassId="WinRTBridge.MethodTools" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.ScriptingPinnedArray" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.GCHandles" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.UnityEngineObjectTools" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.Utils" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.ArrayTools" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.ObjectInstantiation" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.Marshalling" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.WinRTBridge" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.TypeInformation" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.ExceptionHandling" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="WinRTBridge.GCHandledObjects" ThreadingModel="both" />
      </InProcessServer>
    </Extension>
  </Extensions>
  <build:Metadata>
    <build:Item Name="TargetFrameworkMoniker" Value=".NETCore,Version=v4.5.1" />
    <build:Item Name="VisualStudio" Version="12.0" />
    <build:Item Name="VisualStudioEdition" Value="Microsoft Visual Studio Ultimate 2013" />
    <build:Item Name="OperatingSystem" Version="6.3.9600.16384 (winblue_rtm.130821-1623)" />
    <build:Item Name="Microsoft.Build.AppxPackage.dll" Version="12.0.30501.0" />
    <build:Item Name="Microsoft.Windows.UI.Xaml.Build.Tasks.dll" Version="12.0.30501.0" />
    <build:Item Name="MakePri.exe" Version="6.3.9600.17029 (winblue_gdr.140219-1702)" />
  </build:Metadata>
</Package>

I’m hitting this same error, has anyone managed to successfully build and include KinectUnityAddin.dll into a Windows Store App?

@Tomas1856 , have you had any luck since?

I’ve tried manually editing the Appxmanifest.xml in the AppX dir with the following, (and using a cut-down version of the Kinect API that only calls Windows.Kinect.KinectSensor.GetDefault()) I then manually re-package, re-sign & deploy but still no joy:

From the Kinect SDK Release notes, it looks like it should be possible to build a Windows Store app on Windows 8.1:

I presume Kinect SDK is free of charge? I will try to set it up this week and see if there are any problems.

Looks like there is already a Kinect example for Unity already. Check it out http://peted.azurewebsites.net/kinecting-xaml-unity/ I haven’t tried it myself, though. But it still might help you.

1 Like

@Tomas1856 , the SDK is indeed free of charge.

The most recent one from Microsoft is here:
http://www.microsoft.com/en-us/kinectforwindows/develop/downloads-docs.aspx
(which links to here: http://www.microsoft.com/en-us/download/details.aspx?id=44561)

On the above page you can find the “Unity Pro Packages” containing the KinectUnityAddin.dll in question:
http://go.microsoft.com/fwlink/?LinkId=513177

Thanks for looking into this!

Thanks for the tip Artiom, I’ll try that now. From the blog post it looks like I’m doing all the same steps.

@ just an FYI, I am still having this same issue and have tried the fixes as well.

1 Like

Ok, I’ve made progress. Thanks to @Artiom-K , I pulled apart the “Earth” XAML / Unity / Kinect example and figured out why we’re getting the “Class Not Registered.” Basically, the Visual Studio project created from Unity is missing some required Win 8.1 SDK References, in particular: “WindowsPreview.Kinect” and “Microsoft.Kinect.VisualGestureBuilder”(see the attached screenshot.)

I suppose this makes sense, Unity doesn’t know that the KinectUnityAddin requires specific windows sdk frameworks.

EDIT: Adding these references updates the Appxmanfiest.xml file (among others), so that it contains these extra entries:

<Dependencies>
    <PackageDependency Name="Microsoft.VCLibs.120.00.Debug" MinVersion="12.0.21005.1" />
    <PackageDependency Name="Microsoft.WindowsPreview.Kinect.8.1" MinVersion="2.0.1410.19000" />
  </Dependencies>

.......

<Extension Category="windows.activatableClass.inProcessServer">
      <InProcessServer>
        <Path>Microsoft.Kinect.VisualGestureBuilder.dll</Path>
        <ActivatableClass ActivatableClassId="Microsoft.Kinect.VisualGestureBuilder.VisualGestureBuilderFrameSource" ThreadingModel="both" />
        <ActivatableClass ActivatableClassId="Microsoft.Kinect.VisualGestureBuilder.VisualGestureBuilderDatabase" ThreadingModel="both" />
      </InProcessServer>
    </Extension>

........

<build:Item Name="Microsoft.Kinect.VisualGestureBuilder" Version="2.0" />

So I suppose the next question is, @Tomas1856 do you know how to add these references within Unity?

@kbo4sho88 this should help!

1937548--125237--AddReference.PNG

Thanks @ . I feel like we are getting close to a solution here. It feels like it’s all related to the export from unity.

My project shouldn’t need the VisualGestureBuilder extension and I believe that WindowsPreview.Kinect was needed for Kinect support only during the Kinect V2 beta.

I did add them to my projects and received this error when building

Error 1 The command "echo UnityInstallationDir ‘C:\Program Files (x86)\Unity\Editor’
echo UnityProjectDir ‘C:\Users\me\Documents\GitHub\UnityMoths’
echo Copying assemblies…
copy /Y “C:\Users\me\Desktop\UnityBuilds\Moths18\JCD Moths\Unprocessed*” "C:\Users\me\Desktop\UnityBuilds\Moths18\JCD Moths"
copy /Y “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Unprocessed\Assembly-CSharp.dll” “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Assembly-CSharp.dll”
copy /Y “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Unprocessed\Assembly-CSharp-firstpass.dll” “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Assembly-CSharp-firstpass.dll”
if exist “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Unprocessed\Assembly-CSharp.pdb” copy /Y “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Unprocessed\Assembly-CSharp.pdb” “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Assembly-CSharp.pdb”
if exist “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Unprocessed\Assembly-CSharp-firstpass.pdb” copy /Y “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Unprocessed\Assembly-CSharp-firstpass.pdb” “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Assembly-CSharp-firstpass.pdb”
echo Running AssemblyConverter…
“C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\MetroSupport\Tools\AssemblyConverter.exe” -platform=wsa81 “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Assembly-CSharp.dll” “C:\Users\me\Documents\GitHub\UnityMoths\bin\Store 8.1\x64\Debug\Assembly-CSharp-firstpass.dll” “C:\Users\me\Desktop\UnityBuilds\Moths18\JCD Moths\Assembly-UnityScript-firstpass.dll” “C:\Users\me\Desktop\UnityBuilds\Moths18\JCD Moths\Boo.Lang.dll” “C:\Users\me\Desktop\UnityBuilds\Moths18\JCD Moths\UnityEngine.dll” “C:\Users\me\Desktop\UnityBuilds\Moths18\JCD Moths\UnityEngine.UI.dll” “C:\Users\me\Desktop\UnityBuilds\Moths18\JCD Moths\UnityScript.Lang.dll” “C:\Users\me\Desktop\UnityBuilds\Moths18\JCD Moths\WinRTLegacy.dll”
echo AssemblyConverter done.
" exited with code 1. JCD Moths

Thanks again, I’ll keep working on it and of course will post back here if I find a solution

Sadly, there’s no such option, Unity cannot know, that you are required to add such references.

But that’s also the reason, why Unity doesn’t overwrite the generated solution and project if they’re already present, so if you add these extra references, the next time you export from Unity, they won’t be gone.

Ah brilliant, that’s perfect. I thought the generated solutions & projects were overwritten. Thanks for the tip!

@kbo4sho88 I can’t see why the snippet you pasted errored. I’d recommend making sure all the paths in your UnityCommon.props file are correct, then clearing / creating a new Windows Store build folder and try “build & run” from within Unity. Hope that helps!

I believe I had some conflicts with the pre release version of the Kinect SDK. I uninstalled all versions of the SDK and reinstalled the latest one.

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
-Make sure apppackage.manifest has webcam and mic capabilities
-Add references to KinectPreview extension to the two supporting projects in my solution
-Change build configuration to x86 on the two supporting projects and in the configuration manager
-Run and smile

Thanks @ @Tomas1856 and everyone else who helped out.

UPDATE: I did notice that at least on my hardware, if all of the steps are not taken, running and receiving errors can cause the Kinect sensor to get into a state where it can not be connected to. The only way I am able to resolve when this occurs is to restart my computer.

Hi, I’ve been trying to achieve the same thing and I’m having similar errors.
"
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.
"

Ive followed bko4sh088’s steps in the above post but I still get the same error. Could you please post some more detailed instructions? Also has anyone done this with Unity 5? Thats what I’m using

Ok I’ve got this working for Unity 5

  1. Set up the dll in metro folder to build for WSAPlayer
  2. Tick microphone and webcam boxes in player settings, publishing settings, capabilities
  3. Build for windows 8.1 (do not tick C# project box)
  4. 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)