Uni Joystick by Bian-Sh - 3

GUI

It is a very cool Joystick base on UGUI which made it within 100 lines of codes.

Unity 2018.2.16f1MIT LicenseUpdated 78 days agoCreated on July 7th, 2019
Go to source

UniJoystick

It is a very cool Joystick made with less than 100 lines of codes.

With a simple and clear configuration as well as the UI hierarchy structure.

How to use?

  1. Get instance of the Joystick
  2. Register OnValueChanged event
  3. then just hit the Play button,ha…
    public float speed = 5;
    [SerializeField] Joystick joystick;
    void Start()
    {
        joystick.OnValueChanged.AddListener(v =>
        {
            if (v.magnitude != 0)
            {
                transform.Translate(v.x * speed, 0, v.y * speed, Space.World);
                transform.rotation = Quaternion.LookRotation(new Vector3(v.x, 0, v.y));
            }
        });
    }

You can use it everywhere as you wish .

As we use UGUI components for this joystick which made it suitable for every situation that Eventsystem surported.

No matter cell phone or other tuio device such as surface pro.

No matter one or much more instance of Joystick at the same time or on the same screen is ok .

My Blog

[Unity 3d] 使用UGUI做一个类似王者荣耀的摇杆 - 简书

Show all projects by Bian-Sh