Microsoft Kinect SDK Wrapper For Unity Crash Bug Fix

简介: <p style="border:0px; font-family:'Open Sans',Helvetica,Arial,sans-serif; font-size:16px; margin-top:0px; margin-bottom:24px; outline:0px; padding-top:0px; padding-bottom:0px; vertical-align:basel

There’s a great free Kinect SDK wrapper available for Unity. It’s free & open source but there are still a few problems getting it to run with the 1.0 SDK (as opposed to the beta).

The first problem is that it is pointing to the wrong dll file. When you get this exception:

DllNotFoundException: C:\Program Files (x86)\Microsoft Research KinectSDK\MSRKINECTNUI.DLL

You should open the file KinectInterop.cs and changes all dll paths to:

C:\Windows\System32\Kinect10.dll

This will fix all compiler errors and it should run without problems.

However, it will only run once. When you run it the second time Unity will freeze and you will have to kill the process. Not very convenient.

This is caused by a bug in the Microsoft SDK. According to this page the problem is:

If C++ code is executing NuiInitializa/NuiShutdown multiple times through
the application's lifetime, SetDeviceStatusCallback should be called once,
before invoking those calls.

So apparently a single call to SetDeviceStatusCallback() should fix the problem. To be able to call this method we need to add some code to theKinectInterop.cs file. First of all we need to add an empty struct:

public struct NuiStatusProc
{
}

Then we need to link the native method. In the NativeMethods class add:


[DllImportAttribute(@"C:\Windows\System32\Kinect10.dll", EntryPoint = "NuiSetDeviceStatusCallback")]
	    public static extern void NuiSetDeviceStatusCallback(NuiStatusProc callback);

Now open the file KinectSensor.cs and add this line to the void Awake()method (just before the line “catch (Exception e)”):


NativeMethods.NuiSetDeviceStatusCallback(new NuiStatusProc());

Now everything should run fine. If it doesn’t let me know :O

reference: http://www.rozengain.com/blog/2012/05/10/microsoft-kinect-sdk-wrapper-for-unity-crash-bug-fix/

相关文章
|
图形学 Android开发 iOS开发
|
8月前
|
消息中间件 Arthas 监控
一次RocketMQ ons SDK Bug导致消息不断堆积到重试队列的案例分析
一次RocketMQ ons SDK Bug导致消息不断堆积到重试队列的案例分析
316 1
|
10月前
|
API 图形学
【2023unity游戏制作-mango的冒险】-前六章API,细节,BUG总结小结
【2023unity游戏制作-mango的冒险】-前六章API,细节,BUG总结小结
98 0
|
机器人 语音技术 开发工具
智能电话机器人,使用Microsoft语音识别技术(Speech sdk)
智能电话机器人,使用Microsoft语音识别技术(Speech sdk)
171 0
智能电话机器人,使用Microsoft语音识别技术(Speech sdk)
|
NoSQL 安全 开发工具
乐动ld06激光雷达sdk改bug记录分享
乐动ld06激光雷达sdk改bug记录分享
192 0
乐动ld06激光雷达sdk改bug记录分享
|
移动开发 前端开发 小程序
|
前端开发 Linux 开发工具
Unity Metaverse(四)、接入环信IM SDK 实现用户登录注册
Unity接入环信IM SDK,实现用户登录与注册功能。
195 1
Unity Metaverse(四)、接入环信IM SDK 实现用户登录注册
|
开发工具 图形学
Pico SDK在Unity中如何控制移动
Unity导入Pico SDK后如何进行实际开发呢?想必大家都很好奇。从去年的省赛到今年的国赛, 本人研究Pico有快一年了,刚开始学习的时候自己翻过很多的博主文章,都没有找到自己想要的知识,从那时起,我便下定决心,等国赛过后 自己要写写虚拟设备的使用了,那就以我的视角来为大家讲解Pico SDK的正确使用。
603 1
Pico SDK在Unity中如何控制移动
|
开发工具 vr&ar 图形学
Pico SDK导入Unity工程
2022VR国赛即将开始,对于Pico与Unity的使用已经很熟练了,想为下一届参赛选手及Unity 3D引擎爱好者或者是Pico开发者 聊一下自己的理解,目前Unity引擎的主流打包平台设备就是Pico和Steam VR,我参加的国赛采用的是Pico设备,所以今天就先讲一下Pico
546 0
Pico SDK导入Unity工程