Check out example codes for "unity 2d joystick controls". It will help you in understanding the concepts better.
Code Example 1
public Joystick joystick;
private Vector3 input;
public float Speed = 5f;
private void Update()
{
input = new Vector3(joystick.Horizontal, joystick.Vertical);
Vector3 velocity = input.normalized * Speed;
transform.position += velocity * Time.deltaTime;
}
Learn ReactJs, React Native from akashmittal.com