Hello,
I already made a script for you, if you are using canvas. You can pick the images, size, whenever you want 4 or 8 directional, you can specify the minimum requirement distance for direction to be triggered. There are two types for display: 1) the middle is can jump to the 4 or 8 directions ; 2) the middle is floating around inside the bigger circle. Besides the direction from the Joystick you can also get a value for the distance from the center point of the joystick. All of these stuff can be set from a json, or during runtime (I only tested using json). I'm sorry but I had to make a different constructor from the one that you requested, you need to add the Canvas ID as well so it looks like new Joystick(float ,canvasID );