adevine1618 / KinectSDK-Unity3D_Interface_Plugin

This is a wrapper that allows the user to access Microsoft's Kinect SDK v.1.7 data from inside the free Unity3D game engine. This is a workaround for the problem of Mono not supporting .NET 4.
107 stars 34 forks source link

Unity Freeze on 2nd execution #2

Closed SharpEdgeMarshall closed 12 years ago

SharpEdgeMarshall commented 12 years ago

The wrapper starts and quits correctly but on second run Unity freeze. From the debugger i can see that it never returns from "NUIisReady = KinectWrapper.NuiContextInit(twoPlayer);" call.

I suppose there's something wrong with the Uninit.

adevine1618 commented 12 years ago

You're right! It seems that the Kinect SDK doesn't like it when you uninit the sensor and then re-init it in the same application. Since the Unity editor is running constantly, it thinks it's still being used and won't re-init. It just crashes. I'll fix this asap! Thanks for your help! -Andrew

Date: Fri, 16 Mar 2012 09:04:09 -0700 From: reply@reply.github.com To: adevine@knights.ucf.edu Subject: [KinectSDK-Unity3D_Interface_Plugin] Unity Freeze on 2nd execution (#2)

The wrapper start and quit correctly but on the 2nd run Unity freeze. From the debugger i see that it never returns from "NUIisReady = KinectWrapper.NuiContextInit(twoPlayer);" call.


Reply to this email directly or view it on GitHub: https://github.com/adevine1618/KinectSDK-Unity3D_Interface_Plugin/issues/2

adevine1618 commented 12 years ago

Ok it's been fixed with a trade-off. The sensor remains on after you first push "play." So, be sure to disconnect your sensor after you're done using Unity. When you build your project into an executable, this no longer becomes an issue since you are completely closing the application after each init of the sensor. -Andrew

SharpEdgeMarshall commented 12 years ago

Thank you adevine i was starting to think that i was missing something. Happy to help you

SharpEdgeMarshall commented 12 years ago

There's a new problem now :) Unity freezes as before because you call KinectWrapper.NuiContextInit(); but kinect is yet initialized. Infact if i comment out the call on the 2nd run it works.

Sorry for bad english.

adevine1618 commented 12 years ago

Did you replace KUInterface.dll along with the C# file? There is a provision within the dll (with the new version) that prevents it from re-initializing if it already contains a handle to an active sensor.

SharpEdgeMarshall commented 12 years ago

oh you are right i've not replaced it. Now it's my fault.

Keep up the good work!

adevine1618 commented 12 years ago

Haha no problem, happy to help