- Home /
Literally coin-op hardware? Communication between Unity and hardware.
Basically I am developing a game of type which are present in malls which require coins to continue. So, is there any plugin or unity has this feature inbuilt?
Depending on the device you could just write it yourself using C# or look into other options. If the device exist someone has most probably already written some code to communicate with it or at last get info from it. In the worst case you could just use another language that takes care of getting the info from the coin slot and forwards it to the game.
The best we can do without having the hardware itself is to just help you look for existing solutions, but in that case it would be nice if you could actually mention what kind of device you're talking about inc. some serial number or some other info which we could use to find out more about the device.
Or were you looking for suggestion on the hardware itself? (For example a laser could work)
Answer by tanoshimi · Oct 08, 2013 at 08:11 AM
I'd do it via an Arduino.
Here's an explanation of wiring a coin mech to an Arduino: http://www.instructables.com/id/Make-Money-with-Arduino/
And here's an asset to communicate between Arduino and Unity: https://www.assetstore.unity3d.com/#/content/6804
Ahahah! So great, I looked at this question and thought that nobody would answer it. And then you came with this one, like it's feasable. I like the idea so much I think I'm gonna invest in one of these to play with it. Thanks for pointing this!
Alfred, as a new user, you need to please TIC$$anonymous$$ an answer to close out the question. Cheers
I'm definitely not the OP. just interested in the answer :)
Hi Tanoshimi,
Thank you very much. I will definitely look for that. :)
Answer by Shaolin-Dave · Jan 18, 2016 at 01:58 PM
It's actually a lot simpler than you'd think. You can just use Unity's built-in input system. No need for an Arduino, no need for plugins or extensions of any kind.
Create a new input, call it something like "Coin". Then using a keyboard encoder (like the x-arcade or iPac), wire up the keyboard inputs to authentic arcade joysticks, buttons, and coin mechanisms.
When you put a coin into the mech, it'll send a signal to Unity just like a button being pressed. Just work it into your games controls.