Using mouse input

Now, before we dive into mobile-only solutions, I do want to point out that it is possible to write inputs that work on both mobile and PC, namely using mouse controls. Mobile devices support using mouse clicks as taps on the screen, and we can use the mouse position as being where the screen was touched. This doesn't give you all of the features that the mobile-only options do; we will be discussing that later on in this chapter, but I think it's important to note, since I use this often for ease of testing on both the PC and on my device, making it so I don't have to deploy to a mobile device to test every single change made in the project:

  1. Inside Unity, open up your PlayerBehaviour script and add the following highlighted ...

Get Unity 2017 Mobile Game Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.