A really handy feature that comes with the Unity’s new input system is the ability to quickly and easily add UI mobile controls. Let’s take a look at how to get this setup.
The Unity documentation has some information regarding On-screen buttons as well as On-screen sticks. For this article, let’s use a UI stick to move the player.
If you don’t already have a Canvas in your Hierarchy, create one and add a UI image. I rename the image here to JoyStick, but it’s just an image.
Rather than using the default square image, let’s change the Source Image to Knob.
The knob image is anchored to the bottom left of the screen and positioned to taste.
Add an On-Screen Stick script component to the UI Image. The Movement Range dictates how far you want the image to visually move in any direction based on your player touch controls.
The Control Path is set to Stick(Joystick).