Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by christoff · Nov 28, 2011 at 11:53 PM · deviceexternalusboutputsend

Can unity send an output to an external device?

Hi I wonder if it is possible to send a signal to an external device vai USB. For example if my player took damage could an output send a signal to the usb device, even say if it was a usb light that flashed evreytime a player was shot.

I really want to hook up my electric shock quazzar gun to the game so when you take damage you get a shock.

Any ideas? Thanks ..

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Aleron · Nov 29, 2011 at 01:13 AM 0
Share

You could try messing with the ideas outlined at the following URL:

http://www.developerfusion.com/article/84338/making-usb-c-friendly/

It goes over how to interact with a USB device by treating it as a file stream and reading and writing raw data to it. It may not work, but you could give it a shot.

DISCLAI$$anonymous$$ER: I've never worked with this particular set up and it is entirely possible that you could cause damage to the device by writing incorrect data to it.

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by aldonaletto · Nov 29, 2011 at 01:14 AM

You could use the C# SerialPort class to communicate with serial devices, like a FTDI USB module or an Arduino board. A simple and useful FTDI module is the DLP-IOR4: it connects to USB but appears to the system as a serial port; this module has four relays that can be controlled by sending single characters to the serial port:

alt text

Another alternative is the DLP-IO8-G module: 8 channels that can be individually used as digital outputs, analog or digital inputs.

alt text

Anyway, you would have to use the SerialPort class; take a look at this answer, where Unity communicates with an Arduino board (microcontrolled USB board) - once the COM port is open, sending single character commands is an easy task.

[4]: http://answers.unity3d.com/questions/179311/unity-to-arduino.html

[6]: http://answers.unity3d.com/questions/179311/unity-to-arduino.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by jahroy · Nov 29, 2011 at 01:15 AM

That should be totally possible.

You can basically do anything that .Net allows you to do, so google away and enjoy!

Here's what I get by googling c# usb communication:

  • http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/46aa7fc2-54bd-49c2-8dfc-727a0548c6bc

  • http://www.developerfusion.com/article/84338/making-usb-c-friendly/

  • http://www.dreamincode.net/forums/topic/223342-usb-communication-in-c%23/

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Make a motor turn in real life. 0 Answers

Connecting an external NFC reader with Unity 2 Answers

Problem identifying USB 0 Answers

Possible to use an external camera (USB) while running on Android? 1 Answer

Unity read raw HID data => Debug.Log( data ) 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges