unity kinect手势代替方向键

2015年01月27日 09:59 0 点赞 0 评论 更新于 2025-11-21 15:32

在利用 Unity 和 Kinect 实现手势代替方向键的功能开发过程中,我遇到了一些问题,希望能得到各位大神的帮助。

问题描述

我使用 C++ 编写了一个 Kinect 手势的 DLL 供 Unity 使用,脚本则采用 C# 编写。在 Unity 编辑器中点击 Play 运行时,程序一切正常;然而,当将项目打包成 exe 文件运行时,却出现了报错。

错误信息

error.log

Unity Player [version: Unity 4.3.4f1_e444f76e01cd]
KinectPluginForUnity.dll caused an Access Violation (0xc0000005)
in module KinectPluginForUnity.dll at 001b:6840117c.
Error occurred at 2014-05-07_155058.
C:\Users\Administrator\Documents\Unity Project\ModelView\ModelView.exe, run by Administrator.
28% memory in use.
3540 MB physical memory [2517 MB free].
0 MB paging file [0 MB free].
2048 MB user address space [1762 MB free].
Read from location 00000000 caused an access violation.

Context:
EDI: 0x7682e918 ESI: 0x00000000 EAX: 0x00000000
EBX: 0x03a1e5e8 ECX: 0x7ffdf000 EDX: 0x00000006
EIP: 0x6840117c EBP: 0x0014f138 SegCs: 0x0000001b
EFlags: 0x00010246 ESP: 0x0014f104 SegSs: 0x00000023

Bytes at CS:EIP:
8b 10 50 8b 42 44 ff d0 a1 e4 36 40 68 8b 08 8b

Stack:
0x0014f104: 0014f30c 0a40e4e0 03a39871 0014f138 ......@.q...8...
..............................................
0x0014fcd4:

Module 1
C:\Users\Administrator\Documents\Unity Project\ModelView\ModelView.exe
Image Base: 0x01340000 Image Size: 0x00b65000
File Size: 11288064 File Time: 2014-01-24_062148
Version:
Company:
Product:
FileDesc:
FileVer: 4.3.4.31067
ProdVer: 4.3.4.31067

Module 2
C:\Windows\system32\xinput1_3.dll
Image Base: 0x00400000 Image Size: 0x00016000
File Size: 81768 File Time: 2007-04-04_185342
Version:
Company: Microsoft Corporation
Product: Microsoft? DirectX for Windows?
FileDesc: Microsoft Common Controller API
FileVer: 9.18.944.0
ProdVer: 9.18.944.

......此处略去好多

Module 77
C:\Windows\system32\NSI.dll
Image Base: 0x773f0000 Image Size: 0x00006000
File Size: 8704 File Time: 2009-07-14_091612
Version:
Company: Microsoft Corporation
Product: Microsoft? Windows? Operating System
FileDesc: NSI User-mode interface DLL
FileVer: 6.1.7600.16385
ProdVer: 6.1.7600.16385

== [end of error.log] ==

output_log

Initialize engine version: 4.3.4f1 (e444f76e01cd)
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 9.0c [nvd3dum.dll 9.18.13.3523]
Renderer: NVIDIA GeForce GTX 660
Vendor: NVIDIA
VRAM: 1989 MB (via DXGI)
Caps: Shader=30 DepthRT=1 NativeDepth=1 NativeShadow=1 DF16=0 INTZ=1 RAWZ=0 NULL=1 RESZ=0 SlowINTZ=0
Begin MonoManager ReloadAssembly
Platform assembly: C:\Users\Administrator\Documents\Unity Project\ModelView\ModelView_Data\Managed\UnityEngine.dll (this message is harmless)
Loading C:\Users\Administrator\Documents\Unity Project\ModelView\ModelView_Data\Managed\UnityEngine.dll into Unity Child Domain

......此处略去好多

C:\Windows\system32\dbghelp.dll:dbghelp.dll (68810000), size: 962560 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\dbghelp.dll', fileVersion: 6.1.7601.17514
C:\Windows\system32\SspiCli.dll:SspiCli.dll (75180000), size: 110592 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\SspiCli.dll', fileVersion: 6.1.7601.18270

========== OUTPUTING STACK TRACE ==================
(0x6840117C) (KinectPluginForUnity): (filename not available): (function-name not available) + 0x0

......此处略去好多

(0x7682EE1C) (kernel32): (filename not available): BaseThreadInitThunk + 0x12
(0x772E37EB) (ntdll): (filename not available): RtlInitializeExceptionChain + 0xef
(0x772E37BE) (ntdll): (filename not available): RtlInitializeExceptionChain + 0xc2

========== END OF STACKTRACE ===========
**** Crash! ****

从错误信息来看,KinectPluginForUnity.dll 引发了访问冲突(Access Violation)错误。访问冲突通常是由于程序试图访问未分配给它的内存地址,或者在没有适当权限的情况下访问内存所导致的。具体错误位置显示在 KinectPluginForUnity.dll001b:6840117c 处。

希望各位大神能帮忙分析一下可能的原因,先在此跪谢了!