Showing posts with label Input. Show all posts
Showing posts with label Input. Show all posts

Sunday, March 18, 2018

Testing Touch Input with Mouse

When developing a game for mobile, it is beneficial to be able to test input on the computer before deploying to the mobile device.  In the case of testing a single tap on the screen, the OnMouseDown function will work as a single tap on the mobile device.

In this way, you can test single taps on the computer through mouse clicks, and it will still work once it's deployed.  For more complex touch inputs such as multi-finger and dragging, you'll want to use the Input.GetTouch functions.

Saturday, July 8, 2017

Multi-Player Input

In a multiplayer scenario, at times it is beneficial to distinguish between different input designations and assign them specifically to a player.  In this case, I had a game where one player controlled the vehicle and another player controlled the gun turret on the back.  In this scenario, I needed certain input to be dedicated to a specific player.

To do this in Unity for an Axis Input, set the Joy Num field to a specific player.


For a Button Input, add the term "joystick #" in the button field rather than just stating "joystick".  Using just "joystick" actually allows all controllers to trigger that input.