Adding Mobile Support
So far, our character is able to move around with PC controls, that is with the W, A, S, D keys, Spacebar, mouse clicks, and so on. But you may ask, what about on a mobile device? Here we solve it. Fortunately, Unity offers us an easy solution to solve the character movement with touch controls.
Next, we will add a step by step system that allows us to make movements with our fingers. To do so, we will follow these steps:
- We must make some modifications in the PlayerInstance Prefab, double click on the Prefab located in Assets | Photon | PhotonUnityNetworking | Resources to edit it.
- Unity offers a Prefab that practically brings this system, it is called UI_Canvas_StarterAssetsInputs_Joysticks and we look for it in the path Assets | StarterAssets | Mobile | Prefabs | CanvasInputs and we drag it to the PlayerInstance Prefab.
Figure 2.35 – Adding Mobile Controls Prefab
- Now, we select the UI_Canvas_StarterAssetsInputs_Joysticks...