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.
Go to GameObject->UI->Canvas
That should create a EventSystem in your hierarchy
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);
}
}
only working jump when using MobileSingleStickControl prefab. i cant move. (unity 2018) whats wrong pls
Locking Cursor will prevent joysticks from working with Standard Assets Cross Platform Input.