- Home /
how can i directly access USB/COM in unity?
Hi.
I have a FPS game with a gun in game. i want to have an external gun that connects to usb/com port. i want to use the gun for input in my game and allow the players to use the gun for playing the game. something like Wiimote of Wii console but with my own hardware. is it possible or not?if yes, how?
so thanks.
is the device a popular one. does it have any special driver in C++ or you want to process raw data from USB? (i voted up your question to help)
i am looking for a driver or library for that.i want gat info from usb or com port.so thanks for VOT$$anonymous$$
Yes, but what Ashkan was asking was which external gun are you referring to? A wiimote based one perhaps? Theres a library for that on the wiki. Hardware interfaces vary a lot - that is why you don't get all systems supporting all hardware out of the box.
I need both of them.means that wiimote and my gun.what must i do exactly? if you can gave the library link please. so thanks.
Answer by Shawn · Feb 23, 2010 at 05:12 PM
I would think this would be possible; there are various libraries out there for communicating with com/usb devices through C# .NET which you could leverage to do something like this. You could possibly look into having your device emulate the mouse and keyboard as well and just hook into those same inputs. For example when I was doing some controller tests with a proprietary engine which did not support USB game pads I used a mouse/keyboard emulator for that gamepad and then hooked into the mouse/keyboard events for the corresponding actions.
It is really going to depend on the device you are working with, your knowledge of .NET, and the drivers provided for the device you are working with.
Answer by Ashkan_gc · Mar 04, 2010 at 06:12 AM
find the driver for your device if you really have a known device to use. for using wiimote you can use uniwii. the unify community wiki is a good place to search for scripts and articles that you need.
Your answer
![](https://koobas.hobune.stream/wayback/20220612082705im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Sending messages to DMX 1 Answer
Unity3d vs Custom USB Joystick 0 Answers
Joystick count limit 1 Answer
Can you Build & Run for Windows Phone just like for Android via USB cable? 0 Answers
Unity - IOException: SerialPort.Open() 0 Answers