Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

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

Discussion in 'Windows' started by mangjoey123, Dec 17, 2014.

  1. mangjoey123

    mangjoey123

    Joined:
    Dec 17, 2014
    Posts:
    3
    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.
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,669
    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
     
  3. mangjoey123

    mangjoey123

    Joined:
    Dec 17, 2014
    Posts:
    3
    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
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,669
    Check - http://forum.unity3d.com/threads/wi...ception-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.
     
  5. mangjoey123

    mangjoey123

    Joined:
    Dec 17, 2014
    Posts:
    3
  6. kbo4sho88

    kbo4sho88

    Joined:
    Jan 13, 2015
    Posts:
    8
    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
    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <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">
    3.   <!--
    4.     THIS PACKAGE MANIFEST FILE IS GENERATED BY THE BUILD PROCESS.
    5.  
    6.     Changes to this file will be lost when it is regenerated. To correct errors in this file, edit the source .appxmanifest file.
    7.  
    8.     For more information on package manifest files, see http://go.microsoft.com/fwlink/?LinkID=241727
    9.   -->
    10.   <Identity Name="TestKinectWinStore" Publisher="CN=DefaultCompany" Version="1.0.0.0" ProcessorArchitecture="x86" />
    11.   <Properties>
    12.     <DisplayName>TestKinectWinStore</DisplayName>
    13.     <PublisherDisplayName>DefaultCompany</PublisherDisplayName>
    14.     <Logo>Assets\StoreLogo.png</Logo>
    15.   </Properties>
    16.   <Prerequisites>
    17.     <OSMinVersion>6.3.0</OSMinVersion>
    18.     <OSMaxVersionTested>6.3.0</OSMaxVersionTested>
    19.   </Prerequisites>
    20.   <Resources>
    21.     <Resource Language="EN-US" />
    22.   </Resources>
    23.   <Applications>
    24.     <Application Id="App" Executable="Template.exe" EntryPoint="TestKinectWinStore.App">
    25.       <m2:VisualElements DisplayName="TestKinectWinStore" Square150x150Logo="Assets\MediumTile.png" Square30x30Logo="Assets\SmallLogo.png" Description="TestKinectWinStore" ForegroundText="light" BackgroundColor="#000000">
    26.         <m2:DefaultTile Wide310x150Logo="Assets\WideTile.png" DefaultSize="square150x150Logo"></m2:DefaultTile>
    27.         <m2:SplashScreen Image="Assets\SplashScreen.png" />
    28.       </m2:VisualElements>
    29.     </Application>
    30.   </Applications>
    31.   <Capabilities>
    32.     <DeviceCapability Name="webcam" />
    33.     <DeviceCapability Name="microphone" />
    34.   </Capabilities>
    35.   <Dependencies>
    36.     <PackageDependency Name="Microsoft.VCLibs.120.00.Debug" MinVersion="12.0.21005.1" />
    37.   </Dependencies>
    38.   <Extensions>
    39.     <Extension Category="windows.activatableClass.inProcessServer">
    40.       <InProcessServer>
    41.         <Path>UnityEngineDelegates.dll</Path>
    42.         <ActivatableClass ActivatableClassId="UnityEngineDelegates.PlatformInvoke" ThreadingModel="both" />
    43.         <ActivatableClass ActivatableClassId="UnityEngineDelegates.FunctionDefsDictionary" ThreadingModel="both" />
    44.       </InProcessServer>
    45.     </Extension>
    46.     <Extension Category="windows.activatableClass.inProcessServer">
    47.       <InProcessServer>
    48.         <Path>UnityPlayer.dll</Path>
    49.         <ActivatableClass ActivatableClassId="UnityPlayer.XamlPageAutomationPeer" ThreadingModel="both" />
    50.         <ActivatableClass ActivatableClassId="UnityPlayer.StreamListenerContext" ThreadingModel="both" />
    51.         <ActivatableClass ActivatableClassId="UnityPlayer.MulticastSocketContext" ThreadingModel="both" />
    52.         <ActivatableClass ActivatableClassId="UnityPlayer.AppCallbacks" ThreadingModel="both" />
    53.       </InProcessServer>
    54.     </Extension>
    55.     <Extension Category="windows.activatableClass.inProcessServer">
    56.       <InProcessServer>
    57.         <Path>CLRHost.dll</Path>
    58.         <ActivatableClass ActivatableClassId="WinRTBridge.MethodTools" ThreadingModel="both" />
    59.         <ActivatableClass ActivatableClassId="WinRTBridge.ScriptingPinnedArray" ThreadingModel="both" />
    60.         <ActivatableClass ActivatableClassId="WinRTBridge.GCHandles" ThreadingModel="both" />
    61.         <ActivatableClass ActivatableClassId="WinRTBridge.UnityEngineObjectTools" ThreadingModel="both" />
    62.         <ActivatableClass ActivatableClassId="WinRTBridge.Utils" ThreadingModel="both" />
    63.         <ActivatableClass ActivatableClassId="WinRTBridge.ArrayTools" ThreadingModel="both" />
    64.         <ActivatableClass ActivatableClassId="WinRTBridge.ObjectInstantiation" ThreadingModel="both" />
    65.         <ActivatableClass ActivatableClassId="WinRTBridge.Marshalling" ThreadingModel="both" />
    66.         <ActivatableClass ActivatableClassId="WinRTBridge.WinRTBridge" ThreadingModel="both" />
    67.         <ActivatableClass ActivatableClassId="WinRTBridge.TypeInformation" ThreadingModel="both" />
    68.         <ActivatableClass ActivatableClassId="WinRTBridge.ExceptionHandling" ThreadingModel="both" />
    69.         <ActivatableClass ActivatableClassId="WinRTBridge.GCHandledObjects" ThreadingModel="both" />
    70.       </InProcessServer>
    71.     </Extension>
    72.   </Extensions>
    73.   <build:Metadata>
    74.     <build:Item Name="TargetFrameworkMoniker" Value=".NETCore,Version=v4.5.1" />
    75.     <build:Item Name="VisualStudio" Version="12.0" />
    76.     <build:Item Name="VisualStudioEdition" Value="Microsoft Visual Studio Ultimate 2013" />
    77.     <build:Item Name="OperatingSystem" Version="6.3.9600.16384 (winblue_rtm.130821-1623)" />
    78.     <build:Item Name="Microsoft.Build.AppxPackage.dll" Version="12.0.30501.0" />
    79.     <build:Item Name="Microsoft.Windows.UI.Xaml.Build.Tasks.dll" Version="12.0.30501.0" />
    80.     <build:Item Name="MakePri.exe" Version="6.3.9600.17029 (winblue_gdr.140219-1702)" />
    81.   </build:Metadata>
    82. </Package>
     
    Last edited: Jan 21, 2015
  7. ring

    ring

    Joined:
    Mar 14, 2013
    Posts:
    11
    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:
    https://msdn.microsoft.com/en-us/library/dn758677.aspx
     
  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,669
    I presume Kinect SDK is free of charge? I will try to set it up this week and see if there are any problems.
     
  9. Artiom-K

    Artiom-K

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    8
    ring likes this.
  10. ring

    ring

    Joined:
    Mar 14, 2013
    Posts:
    11
  11. ring

    ring

    Joined:
    Mar 14, 2013
    Posts:
    11
    Thanks for the tip Artiom, I'll try that now. From the blog post it looks like I'm doing all the same steps.
     
  12. kbo4sho88

    kbo4sho88

    Joined:
    Jan 13, 2015
    Posts:
    8
    @ring just an FYI, I am still having this same issue and have tried the fixes as well.
     
    ring likes this.
  13. ring

    ring

    Joined:
    Mar 14, 2013
    Posts:
    11
    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:
    Code (CSharp):
    1. <Dependencies>
    2.     <PackageDependency Name="Microsoft.VCLibs.120.00.Debug" MinVersion="12.0.21005.1" />
    3.     <PackageDependency Name="Microsoft.WindowsPreview.Kinect.8.1" MinVersion="2.0.1410.19000" />
    4.   </Dependencies>
    5.  
    6. .......
    7.  
    8. <Extension Category="windows.activatableClass.inProcessServer">
    9.       <InProcessServer>
    10.         <Path>Microsoft.Kinect.VisualGestureBuilder.dll</Path>
    11.         <ActivatableClass ActivatableClassId="Microsoft.Kinect.VisualGestureBuilder.VisualGestureBuilderFrameSource" ThreadingModel="both" />
    12.         <ActivatableClass ActivatableClassId="Microsoft.Kinect.VisualGestureBuilder.VisualGestureBuilderDatabase" ThreadingModel="both" />
    13.       </InProcessServer>
    14.     </Extension>
    15.  
    16. ........
    17.  
    18. <build:Item Name="Microsoft.Kinect.VisualGestureBuilder" Version="2.0" />
    19.    
    So I suppose the next question is, @Tomas1856 do you know how to add these references within Unity?

    @kbo4sho88 this should help!
     

    Attached Files:

  14. kbo4sho88

    kbo4sho88

    Joined:
    Jan 13, 2015
    Posts:
    8
    Thanks @ring. 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
     
  15. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,669
    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.
     
  16. ring

    ring

    Joined:
    Mar 14, 2013
    Posts:
    11
    Ah brilliant, that's perfect. I thought the generated solutions & projects were overwritten. Thanks for the tip!
     
  17. ring

    ring

    Joined:
    Mar 14, 2013
    Posts:
    11
    @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!
     
  18. kbo4sho88

    kbo4sho88

    Joined:
    Jan 13, 2015
    Posts:
    8
    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 @ring @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.
     
    Last edited: Feb 5, 2015
  19. deltron1830

    deltron1830

    Joined:
    Mar 20, 2013
    Posts:
    27
    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
     
  20. deltron1830

    deltron1830

    Joined:
    Mar 20, 2013
    Posts:
    27
    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)