Skip to content

Repository files navigation

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 。

About

Unity-Joystick,摇杆三种示例,简单移动,模仿王者荣耀,模仿吃鸡

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages