- Home /
how to use Cross platform input MobileSingleStickControl
unity 5 I want to move a object or sprite using a joystick. I'm using the standard assets that came with unity 5. I must be doing something wrong. How do I use the mobile single stick control? Ive tried dragging the prefab to the hierarchy and the main camera neither worked. Also trying to figure this out I visited a unity Answers page and they said to a event system. I tried it made the joystick react to touch but it stuck the joystick in the corner and i was unable to move a object.
Same problem here. Can someone explain it in details? I would be indeed appreciated.
Answer by Saldrac · Apr 14, 2015 at 10:20 PM
Go to GameObject->UI->Canvas
That should create a EventSystem in your hierarchy :)
Answer by Anish Kumar Kodeboyina · Jul 09, 2015 at 06:53 AM
https://www.youtube.com/watch?v=l7YiASYgDC0
watch this video. I hope it clarifies your doubt.
Answer by ulissescad · Jan 11, 2016 at 10:05 AM
Olhando os exemplos de veiculos fiz esse script e fucionou bem para o que foi proposto. Primeiro importe a biblioteca dos assets standards e depois basta recuperar a posicao como foi feito no script abaixo. MovX é uma variável para gerenciar o movimento pelo 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);
}
}
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. $$anonymous$$OVX is a variable for managing the movement by the inspector .
using UnityEngine ; using UnityStandardAssets.CrossPlatformInput ; using System.Collections;
public class $$anonymous$$ov : { $$anonymous$$onoBehaviour
public float $$anonymous$$OVX ;
// Use this for initialization void Start ( ) {
// Joystick.
}
// Update is called once per frame void Update () {
Debug.log ( Input.GetAxisRaw ( " Horizontal "));
this.transform.Translate ( CrossPlatformInput$$anonymous$$anager.GetAxis ( " Horizontal " ) * * $$anonymous$$OVX Time.deltaTime , 0 , 0);
} }
Answer by AiRobotMedia · Aug 12, 2018 at 01:19 AM
Locking Cursor will prevent joysticks from working with Standard Assets Cross Platform Input.
Answer by usthis · May 28, 2018 at 07:01 AM
only working jump when using MobileSingleStickControl prefab. i cant move. (unity 2018) whats wrong pls