One last step to conclude our game is to make it mobile friendly. So far, we can move the character only with a keyboard, but what about mobile devices with a touchscreen instead? If you remember the controls from Chapter 10, Let's Get Physical, we implemented the Movement Component independently from the input. As a result, the Player Controller script is responsible for gathering the input from the player to send it to the character. Also, we made the Player Controller inactive in the case of mobile devices, which is great. However, now it's time to implement the controller for the touchscreen. This will compile when the game runs neither in the Editor or in a standalone version.
To implement the system, we will use the UI system in Unity, which is already suitable for gathering input from touchscreens. Let's start by creating...