Question by
DerrickLau · Nov 21, 2016 at 03:09 AM ·
c#kinectavatar
Why am I getting the error " Failed to create device file: 20 The process cannot access the file because it is being used by another process."?
I made a simple Unity3D game:
I imported the Kinect for Unity plugin included with Kinect SDK v2. I added a 3D model. I created a script that opens the Kinect and tries to read a body frame. The Kinect starts fine. Yet every time I try to run this line: BodyFrame frame = frameReference.BodyFrameReference.AcquireFrame() I am returned a NULL pointer, and I see the below in the Console on Unity3D: Failed to create device file: 20 The process cannot access the file because it is being used by another process.
What am I doing wrong?
Comment
Best Answer
Answer by DerrickLau · Nov 28, 2016 at 05:12 PM
Figured it out: I had to implement OnApplicationQuit() method and do proper Kinect clean up within it to avoid this.