Introduction
This article is about using Mobile_ Joystick_Controller in Unity.
Prerequisites
Unity Environment version 2018.4.19f1
Create the project

First, you have to open the Unity project. Create a plane in your project.

Create a sphere in your project.
Click on the "GameObject" menu in the menu bar. Select Create 3D object (Sphere). The Create Sphere will be added to the scene View.

Create the Canvas
Click on the "GameObject" menu in the menu bar. Select Create UI (Canvas). The Create canvas will be added to the scene View.

Click on the Asset Store. Click on the "Import Joystick Pack".

Drag and drop the Fixed Joystick scripts to Canvas in this scene view.

Click on the "GameObject" menu in the menu bar. Select Create UI (Image). The Create Image will be added to the scene View.

Rename the Image as fixed joystick

Create C# Script
Right click on Assets. Select Create >> C# script

Rename the script as Joybutton & My scripts.

Write the coding like the following,
Double click on the Joybutton. The MonoDevelop-Unity editor will open up.
- using UnityEngine;
- using UnityEngine.EventSystems;
- public class Joybutton: MonoBehaviour, IPointerUpHandler, IPointerDownHandler {
- [HideInInspector]
- public bool pressed;
- // Start is called before the first frame update
- void Start() {}
- // Update is called once per frame
- void Update() {}
- public void OnPointerDown(PointerEventData eventData) {
- pressed = true;
- }
- public void OnPointerUp(PointerEventData eventData) {
- pressed = false;
- }
- }





Rikam PalkarPosted Jun 17, 2020, 10:53 AM
Good one Nitin