Unity 5 mobile single stick control

Hi there, I recently update to Unity 5 and now working on a project on mobile platform. I tried to play around with the new CrossPlatformInput in Unity 5 and implement the “MobileSingleStickControl” prefab that built in under 2D asset. But I unable to get the control to work, the controller UI did shown in the screen but user cannot interact with the controller.

I can’t find any related example on using the control, mostly what I found are joystick control in Unity 4. Please provide me some example or suggestion on the controller.


The most common issue is the joystick popping into a corner, this is fixed by changing Joystick.cs’s OnEnable() to Start(). A demonstration of this fix is covered at 5:30 in this video. Unity Touch Joysticks Canvas UI Tutorial - Touch Input FPS Controller - YouTube

For other issues, watch this video from the start.

You’ve got to have an EventSystem game object in your scene in order to make the virtual joystick work. Just create one in the hierarchy and you`re set.

I haven’t played around with any of the input prefabs and scripts in the standard assets, but I implemented a single-stick control pretty easily with a basic script.

The property Input.touches is a Touch[] that holds all touch input that frame. The state of each Touch can tell you whether it just began or was there the previous frame, and each touch also has a finger id associated with it that allows you to track the movement of individual fingers. And of course you can get the position on the screen.

A bit of basic logic will allow you to determine if there is a new touch inside the bounds of the control stick, and by subtracting the center of the control stick from the position of the touch, you can get an Vector2 representing the offset. Of course that offset will be in pixels, so you’ll probably want to divide that by the radius of the stick in pixels; otherwise the magnitude the control stick gives will vary depending on the DPI of the device.

Hope that helps.

Looking at the examples of vehicles made ​​this script and fucionou well for what was proposed . First import the library of standard assets and then simply recall the position as was done in script below. MOVX is a variable for managing the movement by the inspector .

using UnityEngine ;
using UnityStandardAssets.CrossPlatformInput ;
using System.Collections;

public class Mov : { MonoBehaviour

public float MOVX ;

// Use this for initialization
void Start ( ) {

   // Joystick.


// Update is called once per frame
void Update () {

    Debug.log ( Input.GetAxisRaw ( " Horizontal "));

    this.transform.Translate ( CrossPlatformInputManager.GetAxis ( " Horizontal " ) * * MOVX Time.deltaTime , 0 , 0);


i have a simlar problem but its a bit diferent i can t cheak
the box at the left corner at the top i got that asset from
standar assets