This is the most simple way to have a joystick on your game.
The project comes with three images one for the exit application and two images for the joystick.
One image is for the background joystick on this I add another image for the joystick.
The projects have two C# scripts: one for the Capsule object and one for the background joystick image.
The source code is very simple to understand.
The VirtualJoystick class is used to take positions of the background joystick image.
The Rigidbody of the Capsule object use the script where is the VirtualJoystickTest class.
The VirtualJoystick class use interface like: IDragHandler, IPointerUpHandler and IPointerDownHandler.
For EventSystem features, I install the Input System from menu : Windows – Package Manager.
The full source code can be found on my GitHub account project.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.