I have this code
using UnityEngine;
using System.Collections;
public class moveByTouch : MonoBehaviour {
private Vector3 pos;
private bool EnableTouch = false;
// Use this for initialization
void Start () {
Screen.sleepTimeout = SleepTimeout.NeverSleep;
}
// Update is called once per frame
void Update () {
MoveUpdate ();
}
void OnMouseDown()
{
EnableTouch = true;
Destroy (gameObject);
}
void OnMouseUp()
{
EnableTouch = false;
}
void MoveUpdate()
{
if (Application.platform == RuntimePlatform.Android ) {
pos = Camera.main.ScreenToWorldPoint (new Vector3 (Input.GetTouch (0).position.x,Input.GetTouch (0).position.y, 1F));
}
transform.position = new Vector3 (pos.x, pos.y, pos.z);
}
}
The only thing that works perfectly is the OnMouseDown, I can touch the screen to destory it, but the moveUpdate doesn’t work in Unity Remote 4, but it work as a apk file.
IM using a Samsung Galaxy S6 egde.
Unity is 5.1.1
Unity Remote 4