简体   繁体   English

如何在 Unity 中使用蓝牙 controller?

[英]How can I use bluetooth controller in Unity?

I have bluetooth controller in picture.我在图片中有蓝牙 controller。 How do I use joystick and other 6 button on my android game?如何在我的 android 游戏上使用操纵杆和其他 6 个按钮? I can acces only escape button on controller with (Input.GetKeyDown(KeyCode.Escape))我只能使用 (Input.GetKeyDown(KeyCode.Escape)) 访问 controller 上的转义按钮

bluetooth controller蓝牙 controller

I use unity controller inputs with joysticks buttons and also I make sample project and uploaded to github https://github.com/malisasmaz/Bluetooth_Controller_VR_Lioneye我使用带有操纵杆按钮的统一 controller 输入,并且我制作了示例项目并上传到 github Z5E056C500A1C4B6A7110B50D_807BADE5ZBluetot://github.com/malisasmaz/

You could probably debug this by doing something like:您可以通过执行以下操作来调试它:

if(Input.anyKeyDown)
    Debug.Log(Input.inputString);

in your update-function to see what buttons are pressed.在您的更新功能中查看按下了哪些按钮。

Documentation for Input.inputString Input.inputString 的文档

You may also find some clues here你也可以在这里找到一些线索

There's also this for setting up controllers.还有这个用于设置控制器。

I was looking for the answer to this question for days, I used the github link given by malisasmaz above, and following the explanations he wrote, the control worked easily in both VR mode and normal mode, thank you.我一直在寻找这个问题的答案,我使用了上面 malisasmaz 给出的 github 链接,按照他写的解释,该控件在 VR 模式和普通模式下都可以轻松工作,谢谢。 Github: https://github.com/malisasmaz/Bluetooth_Controller_VR_Lioneye User: https://stackoverflow.com/users/7199996/malisasmaz Github: https://github.com/malisasmaz/Bluetooth_Controller_VR_Lioneye用户: Z5E056C500A1C4B6A7110B50D807BADE719/stackoverflow.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM