i know how to move with GUI ,but with UI no
What exactly do you want? Which part of your solution that works with the GUI does not work with the UI?
Move right and left with UI …
The problem is that when i click on UI , the player does’nt move constantly
How does the code look for the GUI and how does it look for the UI?
using UnityEngine;
using System.Collections;
public class Movernave : MonoBehaviour {
public float speed = 0f;
public Vector3 pos;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.Translate (speed * Time.deltaTime,0,0);
}
public void AdjustSpeed (float newSpeed) {
speed = newSpeed;
//Debug.Log (newSpeed);
}
}
I usually don’t quote myself, but:
What you posted is not related to the GUI or UI.
Please use code tags:
Simply add your AdjustSpeed method with an appropriate float to th OnClick listener on your button.
But the player just move if i click,i want when i hold the UI touch,hte player move constantly
Ok thanks everbody